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

📄 ra.c

📁 subversion-1.4.5.tar.gz 配置svn的源码
💻 C
📖 第 1 页 / 共 3 页
字号:
  /* use subpool to create a temporary RA session */  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, url,                                               NULL, /* no base dir */                                               NULL, NULL, FALSE, TRUE,                                                ctx, subpool));  SVN_ERR(svn_ra_get_uuid(ra_session, uuid, subpool));  /* Copy the uuid in to the passed-in pool. */  *uuid = apr_pstrdup(pool, *uuid);  /* destroy the RA session */  svn_pool_destroy(subpool);  return SVN_NO_ERROR;}svn_error_t *svn_client_uuid_from_path(const char **uuid,                          const char *path,                          svn_wc_adm_access_t *adm_access,                          svn_client_ctx_t *ctx,                          apr_pool_t *pool){  const svn_wc_entry_t *entry;  SVN_ERR(svn_wc_entry(&entry, path, adm_access,                       TRUE,  /* show deleted */ pool));  if (! entry)    return svn_error_createf(SVN_ERR_ENTRY_NOT_FOUND, NULL,                             _("Can't find entry for '%s'"),                             svn_path_local_style(path, pool));  if (entry->uuid)    {      *uuid = entry->uuid;    }  else if (entry->url)    {      /* fallback to using the network. */      SVN_ERR(svn_client_uuid_from_url(uuid, entry->url, ctx, pool));    }  else    {      /* Try the parent if it's the same working copy.  It's not         entirely clear how this happens (possibly an old wc?) but it         has been triggered by TSVN, see         http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgNo=101831         Message-ID: <877jgjtkus.fsf@debian2.lan> */      svn_boolean_t is_root;      SVN_ERR(svn_wc_is_wc_root(&is_root, path, adm_access, pool));      if (is_root)        return svn_error_createf(SVN_ERR_ENTRY_MISSING_URL, NULL,                                 _("'%s' has no URL"),                                 svn_path_local_style(path, pool));      else        return svn_client_uuid_from_path(uuid, svn_path_dirname(path, pool),                                         adm_access, ctx, pool);    }  return SVN_NO_ERROR;}svn_error_t *svn_client__prev_log_path(const char **prev_path_p,                          char *action_p,                          svn_revnum_t *copyfrom_rev_p,                          apr_hash_t *changed_paths,                          const char *path,                          svn_node_kind_t kind,                          svn_revnum_t revision,                          apr_pool_t *pool){  svn_log_changed_path_t *change;  const char *prev_path = NULL;  /* It's impossible to find the predecessor path of a NULL path. */  assert(path);  /* Initialize our return values for the action and copyfrom_rev in     case we have an unhandled case later on. */  if (action_p)    *action_p = 'M';  if (copyfrom_rev_p)    *copyfrom_rev_p = SVN_INVALID_REVNUM;  /* See if PATH was explicitly changed in this revision. */  change = apr_hash_get(changed_paths, path, APR_HASH_KEY_STRING);  if (change)    {      /* If PATH was not newly added in this revision, then it may or may         not have also been part of a moved subtree.  In this case, set a         default previous path, but still look through the parents of this         path for a possible copy event. */      if (change->action != 'A' && change->action != 'R')        {          prev_path = path;        }      else        {          /* PATH is new in this revision.  This means it cannot have been             part of a copied subtree. */          if (change->copyfrom_path)            prev_path = apr_pstrdup(pool, change->copyfrom_path);          else            prev_path = NULL;                    *prev_path_p = prev_path;          if (action_p)            *action_p = change->action;          if (copyfrom_rev_p)            *copyfrom_rev_p = change->copyfrom_rev;          return SVN_NO_ERROR;        }    }    if (apr_hash_count(changed_paths))    {      /* The path was not explicitly changed in this revision.  The         fact that we're hearing about this revision implies, then,         that the path was a child of some copied directory.  We need         to find that directory, and effectively "re-base" our path on         that directory's copyfrom_path. */      int i;      apr_array_header_t *paths;      /* Build a sorted list of the changed paths. */      paths = svn_sort__hash(changed_paths,                             svn_sort_compare_items_as_paths, pool);      /* Now, walk the list of paths backwards, looking a parent of         our path that has copyfrom information. */      for (i = paths->nelts; i > 0; i--)        {          svn_sort__item_t item = APR_ARRAY_IDX(paths,                                                i - 1, svn_sort__item_t);          const char *ch_path = item.key;          int len = strlen(ch_path);          /* See if our path is the child of this change path.  If             not, keep looking.  */          if (! ((strncmp(ch_path, path, len) == 0) && (path[len] == '/')))            continue;          /* Okay, our path *is* a child of this change path.  If             this change was copied, we just need to apply the             portion of our path that is relative to this change's             path, to the change's copyfrom path.  Otherwise, this             change isn't really interesting to us, and our search             continues. */          change = apr_hash_get(changed_paths, ch_path, len);          if (change->copyfrom_path)            {              if (action_p)                *action_p = change->action;              if (copyfrom_rev_p)                *copyfrom_rev_p = change->copyfrom_rev;              prev_path = svn_path_join(change->copyfrom_path,                                         path + len + 1, pool);              break;            }        }    }  /* If we didn't find what we expected to find, return an error.     (Because directories bubble-up, we get a bunch of logs we might     not want.  Be forgiving in that case.)  */  if (! prev_path)    {      if (kind == svn_node_dir)        prev_path = apr_pstrdup(pool, path);      else        return svn_error_createf(SVN_ERR_CLIENT_UNRELATED_RESOURCES, NULL,                                 _("Missing changed-path information for "                                   "'%s' in revision %ld"),                                 svn_path_local_style(path, pool), revision);    }    *prev_path_p = prev_path;  return SVN_NO_ERROR;}/* ### This is to support 1.0 servers. */struct log_receiver_baton{  /* The kind of the path we're tracing. */  svn_node_kind_t kind;  /* The path at which we are trying to find our versioned resource in     the log output. */  const char *last_path;  /* Input revisions and output paths; the whole point of this little game. */  svn_revnum_t start_revision;  const char **start_path_p;  svn_revnum_t end_revision;  const char **end_path_p;  svn_revnum_t peg_revision;  const char *peg_path;    /* Client context baton. */  svn_client_ctx_t *ctx;  /* A pool from which to allocate stuff stored in this baton. */  apr_pool_t *pool;};/* Implements svn_log_message_receiver_t; helper for   slow_get_locations.  As input, takes log_receiver_baton   (defined above) and attempts to "fill in" all three paths in the   baton over the course of many iterations. */static svn_error_t *log_receiver(void *baton,             apr_hash_t *changed_paths,             svn_revnum_t revision,             const char *author,             const char *date,             const char *message,             apr_pool_t *pool){  struct log_receiver_baton *lrb = baton;  const char *current_path = lrb->last_path;  const char *prev_path;  /* See if the user is fed up with this time-consuming process yet. */  if (lrb->ctx->cancel_func)    SVN_ERR(lrb->ctx->cancel_func(lrb->ctx->cancel_baton));  /* No paths were changed in this revision.  Nothing to do. */  if (!changed_paths)    return SVN_NO_ERROR;  /* If we've run off the end of the path's history, there's nothing     to do.  (This should never happen with a properly functioning     server, since we'd get no more log messages after the one where     path was created.  But a malfunctioning server shouldn't cause us     to trigger an assertion failure.) */  if (! current_path)    return SVN_NO_ERROR;    /* Determine the paths for any of the revisions for which we haven't     gotten paths already. */  if ((! *lrb->start_path_p) && (revision <= lrb->start_revision))    *lrb->start_path_p = apr_pstrdup(lrb->pool, current_path);  if ((! *lrb->end_path_p) && (revision <= lrb->end_revision))    *lrb->end_path_p = apr_pstrdup(lrb->pool, current_path);  if ((! lrb->peg_path) && (revision <= lrb->peg_revision))    lrb->peg_path = apr_pstrdup(lrb->pool, current_path);  /* Figure out at which repository path our object of interest lived     in the previous revision. */  SVN_ERR(svn_client__prev_log_path(&prev_path, NULL, NULL, changed_paths,                                    current_path, lrb->kind,                                     revision, pool));  /* Squirrel away our "next place to look" path (suffer the strcmp     hit to save on allocations). */  if (! prev_path)    lrb->last_path = NULL;  else if (strcmp(prev_path, current_path) != 0)    lrb->last_path = apr_pstrdup(lrb->pool, prev_path);  return SVN_NO_ERROR;}/* Use the RA layer get_log() function to get the locations at START_REVNUM   and END_REVNUM.   The locations are put in START_PATH and END_PATH, respectively.  ABS_PATH   is the path as seen in PEG_REVISION for which to get the locations.   ORIG_PATH is only used for error messages.   ### This is needed for 1.0.x servers, which don't have the get_locations   RA layer function. */static svn_error_t *slow_locations(const char **start_path, const char** end_path,               const char *abs_path, svn_revnum_t peg_revnum,               svn_revnum_t start_revnum, svn_revnum_t end_revnum,               const char *orig_path,               svn_ra_session_t *ra_session,               svn_client_ctx_t *ctx,               apr_pool_t *pool){  struct log_receiver_baton lrb = { 0 };  apr_array_header_t *targets;  svn_revnum_t youngest, oldest;  svn_boolean_t pegrev_is_youngest = FALSE;  /* Sanity check:  verify that the peg-object exists in repos. */  SVN_ERR(svn_ra_check_path(ra_session, "", peg_revnum, &(lrb.kind), pool));  if (lrb.kind == svn_node_none)    return svn_error_createf      (SVN_ERR_FS_NOT_FOUND, NULL,       _("path '%s' doesn't exist in revision %ld"),       orig_path, peg_revnum);  /* Populate most of our log receiver baton structure. */  lrb.last_path = abs_path;  lrb.start_revision = start_revnum;  lrb.end_revision = end_revnum;  lrb.peg_revision = peg_revnum;  lrb.start_path_p = start_path;  lrb.end_path_p = end_path;  lrb.ctx = ctx;  lrb.pool = pool;  /* Figure out the youngest and oldest revs. */  youngest = peg_revnum;  youngest = (start_revnum > youngest) ? start_revnum : youngest;  youngest = (end_revnum > youngest) ? end_revnum : youngest;  oldest = peg_revnum;  oldest = (start_revnum < oldest) ? start_revnum : oldest;

⌨️ 快捷键说明

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