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

📄 update.c

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 C
📖 第 1 页 / 共 5 页
字号:
      info->base_rev = apr_atoi64(rev);      info->target_rev = ctx->target_rev;      info->fetch_props = FALSE;      info->base_name = apr_pstrdup(info->pool, file_name);      info->name = NULL;    }  else if ((state == OPEN_DIR || state == ADD_DIR) &&           strcmp(name.name, "add-file") == 0)    {      const char *file_name;      report_info_t *info;      file_name = svn_ra_serf__find_attr(attrs, "name");      if (!file_name)        {          abort();        }      info = push_state(parser, ctx, ADD_FILE);      info->base_rev = SVN_INVALID_REVNUM;      info->target_rev = ctx->target_rev;      info->fetch_props = TRUE;      info->fetch_file = TRUE;      info->base_name = apr_pstrdup(info->pool, file_name);      info->name = NULL;    }  else if ((state == OPEN_DIR || state == ADD_DIR) &&           strcmp(name.name, "delete-entry") == 0)    {      const char *file_name;      svn_stringbuf_t *name_buf;      report_info_t *info;      apr_pool_t *tmppool;      file_name = svn_ra_serf__find_attr(attrs, "name");      if (!file_name)        {          abort();        }      info = parser->state->private;      SVN_ERR(open_dir(info->dir));      apr_pool_create(&tmppool, info->dir->dir_baton_pool);      name_buf = svn_stringbuf_dup(info->dir->name_buf, tmppool);      svn_path_add_component(name_buf, file_name);      SVN_ERR(info->dir->update_editor->delete_entry(name_buf->data,                                                     SVN_INVALID_REVNUM,                                                     info->dir->dir_baton,                                                     tmppool));      apr_pool_destroy(tmppool);    }  else if ((state == OPEN_DIR || state == ADD_DIR) &&           strcmp(name.name, "absent-directory") == 0)    {      const char *file_name;      report_info_t *info;      file_name = svn_ra_serf__find_attr(attrs, "name");      if (!file_name)        {          abort();        }      info = parser->state->private;      SVN_ERR(open_dir(info->dir));      ctx->update_editor->absent_directory(file_name,                                           info->dir->dir_baton,                                           info->dir->pool);    }  else if ((state == OPEN_DIR || state == ADD_DIR))    {      report_info_t *info;      if (strcmp(name.name, "checked-in") == 0)        {          info = push_state(parser, ctx, IGNORE_PROP_NAME);          info->prop_ns = name.namespace;          info->prop_name = apr_pstrdup(parser->state->pool, name.name);          info->prop_encoding = NULL;          info->prop_val = NULL;          info->prop_val_len = 0;        }      else if (strcmp(name.name, "set-prop") == 0 ||                strcmp(name.name, "remove-prop") == 0)        {          const char *full_prop_name;          const char *colon;          info = push_state(parser, ctx, PROP);          full_prop_name = svn_ra_serf__find_attr(attrs, "name");          colon = strchr(full_prop_name, ':');          if (colon)            colon++;          else            colon = full_prop_name;          info->prop_ns = apr_pstrmemdup(info->dir->pool, full_prop_name,                                         colon - full_prop_name);          info->prop_name = apr_pstrdup(parser->state->pool, colon);          info->prop_encoding = svn_ra_serf__find_attr(attrs, "encoding");          info->prop_val = NULL;          info->prop_val_len = 0;        }      else if (strcmp(name.name, "prop") == 0)        {          /* need to fetch it. */          push_state(parser, ctx, NEED_PROP_NAME);        }      else if (strcmp(name.name, "fetch-props") == 0)        {          info = parser->state->private;          info->dir->fetch_props = TRUE;        }      else        {          abort();        }    }  else if ((state == OPEN_FILE || state == ADD_FILE))    {      report_info_t *info;      if (strcmp(name.name, "checked-in") == 0)        {          info = push_state(parser, ctx, IGNORE_PROP_NAME);          info->prop_ns = name.namespace;          info->prop_name = apr_pstrdup(parser->state->pool, name.name);          info->prop_encoding = NULL;          info->prop_val = NULL;          info->prop_val_len = 0;        }      else if (strcmp(name.name, "prop") == 0)        {          /* need to fetch it. */          push_state(parser, ctx, NEED_PROP_NAME);        }      else if (strcmp(name.name, "fetch-props") == 0)        {          info = parser->state->private;          info->fetch_props = TRUE;        }      else if (strcmp(name.name, "fetch-file") == 0)        {          info = parser->state->private;          info->fetch_file = TRUE;        }      else if (strcmp(name.name, "set-prop") == 0 ||               strcmp(name.name, "remove-prop") == 0)        {          const char *full_prop_name;          const char *colon;          info = push_state(parser, ctx, PROP);          full_prop_name = svn_ra_serf__find_attr(attrs, "name");          colon = strchr(full_prop_name, ':');          if (colon)            colon++;          else            colon = full_prop_name;          info->prop_ns = apr_pstrmemdup(info->dir->pool, full_prop_name,                                         colon - full_prop_name);          info->prop_name = apr_pstrdup(parser->state->pool, colon);          info->prop_encoding = svn_ra_serf__find_attr(attrs, "encoding");          info->prop_val = NULL;          info->prop_val_len = 0;        }      else        {          abort();        }    }  else if (state == IGNORE_PROP_NAME)    {      push_state(parser, ctx, PROP);    }  else if (state == NEED_PROP_NAME)    {      report_info_t *info;      info = push_state(parser, ctx, PROP);            info->prop_ns = name.namespace;      info->prop_name = apr_pstrdup(parser->state->pool, name.name);      info->prop_val = NULL;      info->prop_val_len = 0;    }  return SVN_NO_ERROR;}static svn_error_t *end_report(svn_ra_serf__xml_parser_t *parser,           void *userData,           svn_ra_serf__dav_props_t name){  report_context_t *ctx = userData;  report_state_e state;  state = parser->state->current_state;  if (state == NONE)    {      /* nothing to close yet. */      return SVN_NO_ERROR;    }  if (((state == OPEN_DIR && (strcmp(name.name, "open-directory") == 0)) ||       (state == ADD_DIR && (strcmp(name.name, "add-directory") == 0))))    {      const char *checked_in_url;      report_info_t *info = parser->state->private;      /* We've now closed this directory; note it. */      info->dir->tag_closed = TRUE;      /* go fetch info->file_name from DAV:checked-in */      checked_in_url =          svn_ra_serf__get_ver_prop(info->dir->props, info->base_name,                                    info->base_rev, "DAV:", "checked-in");      /* If we were expecting to have the properties and we aren't able to       * get it, bail.       */      if (!checked_in_url &&          (!SVN_IS_VALID_REVNUM(info->dir->base_rev) || info->dir->fetch_props))        {          abort();        }      info->dir->url = checked_in_url;      /* At this point, we should have the checked-in href.       * If needed, create the PROPFIND to retrieve the dir's properties.       */      if (!SVN_IS_VALID_REVNUM(info->dir->base_rev) || info->dir->fetch_props)        {          /* Unconditionally set fetch_props now. */          info->dir->fetch_props = TRUE;          svn_ra_serf__deliver_props(&info->dir->propfind, info->dir->props,                                     ctx->sess,                                     ctx->sess->conns[ctx->sess->cur_conn],                                     info->dir->url, info->dir->target_rev,                                     "0", all_props, FALSE,                                     &ctx->done_propfinds, info->dir->pool);          if (!info->dir->propfind)            {              abort();            }          ctx->active_propfinds++;        }      else        {          info->dir->propfind = NULL;        }      svn_ra_serf__xml_pop_state(parser);    }  else if (state == OPEN_FILE && strcmp(name.name, "open-file") == 0)    {      report_info_t *info = parser->state->private;      /* Expand our full name now if we haven't done so yet. */      if (!info->name)        {          info->name_buf = svn_stringbuf_dup(info->dir->name_buf, info->pool);          svn_path_add_component(info->name_buf, info->base_name);          info->name = info->name_buf->data;        }            info->lock_token = apr_hash_get(ctx->lock_path_tokens, info->name,                                      APR_HASH_KEY_STRING);            if (info->lock_token && info->fetch_props == FALSE)        info->fetch_props = TRUE;      /* If we have a WC, we can dive all the way into the WC to get the       * previous URL so we can do an differential GET with the base URL.       *       * If we don't have a WC (as is the case for URL<->URL diff), we can       * manually reconstruct the base URL.  This avoids us having to grab       * two full-text for URL<->URL diffs.  Instead, we can just grab one       * full-text and a diff from the server against that other file.       */      if (ctx->sess->wc_callbacks->get_wc_prop)        {          ctx->sess->wc_callbacks->get_wc_prop(ctx->sess->wc_callback_baton,                                               info->name,                                               SVN_RA_SERF__WC_CHECKED_IN_URL,                                               &info->delta_base,                                               info->pool);        }      else        {          const char *c;          apr_size_t comp_count;          svn_stringbuf_t *path;          svn_boolean_t fix_root = FALSE;          c = svn_ra_serf__get_ver_prop(info->props, info->base_name,                                        info->base_rev, "DAV:", "checked-in");          path = svn_stringbuf_create(c, info->pool);          comp_count = svn_path_component_count(info->name_buf->data);          svn_path_remove_components(path, comp_count);          /* Our paths may be relative to a file from the actual root, so           * we would need to strip out the difference from our fixed point           * to the root and then add it back in after we replace the           * version number.           */          if (strcmp(ctx->source, ctx->sess->repos_root.path) != 0)            {              apr_size_t root_count, src_count;              src_count = svn_path_component_count(ctx->source);              root_count = svn_path_component_count(ctx->sess->repos_root.path);              svn_path_remove_components(path, src_count - root_count);              fix_root = TRUE;            }          /* At this point, we should just have the version number           * remaining.  We know our target revision, so we'll replace it           * and recreate what we just chopped off.          */          svn_path_remove_component(path);          svn_path_add_component(path, apr_ltoa(info->pool, info->base_rev));          if (fix_root == TRUE)            {              apr_size_t root_len;              root_len = strlen(ctx->sess->repos_root.path) + 1;              svn_path_add_component(path, &ctx->source[root_len]);            }          svn_path_add_component(path, info->name);          info->delta_base = svn_string_create_from_buf(path, info->pool);        }      fetch_file(ctx, info);      svn_ra_serf__xml_pop_state(parser);    }  else if (state == ADD_FILE && strcmp(name.name, "add-file") == 0)    {      /* We should have everything we need to fetch the file. */      fetch_file(ctx, parser->state->private);      svn_ra_serf__xml_pop_state(parser);    }  else if (state == PROP)    {      /* We need to move the prop_ns, prop_name, and prop_val into the       * same lifetime as the dir->pool.       */      svn_ra_serf__ns_t *ns, *ns_name_match;      int found = 0;      report_info_t *info;      report_dir_t *dir;      apr_hash_t *props;      const char *set_val;      svn_string_t *set_val_str;      apr_pool_t *pool;      info = parser->state->private;      dir = info->dir;      /* We're going to be slightly tricky.  We don't care what the ->url       * field is here at this point.  So, we're going to stick a single       * copy of the property name inside of the ->url field.       */      ns_name_match = NULL;      for (ns = dir->ns_list; ns; ns = ns->next)        {          if (strcmp(ns->namespace, info->prop_ns) == 0)            {              ns_name_match = ns;              if (strcmp(ns->url, info->prop_name) == 0)                {                  found = 1;                  break;                }            }        }      if (!found)        {          ns = apr_palloc(dir->pool, sizeof(*ns));          if (!ns_name_match)            {              ns->namespace = apr_pstrdup(dir->pool, info->prop_ns);            }          else            {              ns->namespace = ns_name_match->namespace;            }          ns->url = apr_pstrdup(dir->pool, info->prop_name);          ns->next = dir->ns_list;          dir->ns_list = ns;        }      if (strcmp(name.name, "remove-prop") != 0)        {          props = info->props;          pool = info->pool;        }      else

⌨️ 快捷键说明

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