FreeBSD/contrib/subversion/subversion/libsvn_ra_serf/inherited_props.c
/* Request a inherited-props-report from the URL attached to RA_SESSION,
   and fill the IPROPS array hash with the results.  */
Request a inherited-props-report from the URL attached to RA_SESSION,
and fill the IPROPS array hash with the results.
Request a inherited - props - report from the URL attached to RA_SESSION and fill the IPROPS array hash with the results .
svn_error_t *
svn_ra_serf__get_inherited_props(svn_ra_session_t *ra_session,
                                 apr_array_header_t **iprops,
                                 const char *path,
                                 svn_revnum_t revision,
                                 apr_pool_t *result_pool,
                                 apr_pool_t *scratch_pool)
{
  iprops_context_t *iprops_ctx;
  svn_ra_serf__session_t *session = ra_session->priv;
  svn_ra_serf__handler_t *handler;
  svn_ra_serf__xml_context_t *xmlctx;
  const char *req_url;
  svn_boolean_t iprop_capable;
  SVN_ERR(svn_ra_serf__has_capability(ra_session, &iprop_capable,
                                      SVN_RA_CAPABILITY_INHERITED_PROPS,
                                      scratch_pool));
  if (!iprop_capable)
    {
      svn_error_t *err;
      const char *reparent_uri = NULL;
      const char *session_uri;
      const char *repos_root_url;
      SVN_ERR(svn_ra_serf__get_repos_root(ra_session, &repos_root_url,
                                          scratch_pool));
      session_uri = apr_pstrdup(scratch_pool, session->session_url_str);
      if (strcmp(repos_root_url, session->session_url_str) != 0)
        {
          reparent_uri  = session_uri;
          SVN_ERR(svn_ra_serf__reparent(ra_session, repos_root_url,
                                        scratch_pool));
        }
      err = get_iprops_via_more_requests(ra_session, iprops, session_uri, path,
                                         revision, result_pool, scratch_pool);
      if (reparent_uri)
        err = svn_error_compose_create(err,
                                       svn_ra_serf__reparent(ra_session,
                                                             reparent_uri ,
                                                             scratch_pool));
      return svn_error_trace(err);
    }
  SVN_ERR(svn_ra_serf__get_stable_url(&req_url,
                                      NULL ,
                                      session,
                                      NULL ,
                                      revision,
                                      scratch_pool, scratch_pool));
  SVN_ERR_ASSERT(session->repos_root_str);
  iprops_ctx = apr_pcalloc(scratch_pool, sizeof(*iprops_ctx));
  iprops_ctx->repos_root_url = session->repos_root_str;
  iprops_ctx->pool = result_pool;
  iprops_ctx->curr_propname = svn_stringbuf_create_empty(scratch_pool);
  iprops_ctx->curr_iprop = NULL;
  iprops_ctx->iprops = apr_array_make(result_pool, 1,
                                       sizeof(svn_prop_inherited_item_t *));
  iprops_ctx->path = path;
  iprops_ctx->revision = revision;
  xmlctx = svn_ra_serf__xml_context_create(iprops_table,
                                           iprops_opened, iprops_closed,
                                           NULL,
                                           iprops_ctx,
                                           scratch_pool);
  handler = svn_ra_serf__create_expat_handler(session, xmlctx, NULL,
                                              scratch_pool);
  handler->method = "REPORT";
  handler->path = req_url;
  handler->body_delegate = create_iprops_body;
  handler->body_delegate_baton = iprops_ctx;
  handler->body_type = "text/xml";
  SVN_ERR(svn_ra_serf__context_run_one(handler, scratch_pool));
  if (handler->sline.code != 200)
    return svn_error_trace(svn_ra_serf__unexpected_status(handler));
  *iprops = iprops_ctx->iprops;
  return SVN_NO_ERROR;
}
svn_error_t * svn_ra_serf__get_inherited_props ( svn_ra_session_t * ra_session , apr_array_header_t * * iprops , const char * path , svn_revnum_t revision , apr_pool_t * result_pool , apr_pool_t * scratch_pool ) { iprops_context_t * iprops_ctx ; svn_ra_serf__session_t * session = ra_session -> priv ; svn_ra_serf__handler_t * handler ; svn_ra_serf__xml_context_t * xmlctx ; const char * req_url ; svn_boolean_t iprop_capable ; SVN_ERR ( svn_ra_serf__has_capability ( ra_session , & iprop_capable , SVN_RA_CAPABILITY_INHERITED_PROPS , scratch_pool ) ) ; if ( ! iprop_capable ) { svn_error_t * err ; const char * reparent_uri = NULL ; const char * session_uri ; const char * repos_root_url ; SVN_ERR ( svn_ra_serf__get_repos_root ( ra_session , & repos_root_url , scratch_pool ) ) ; session_uri = apr_pstrdup ( scratch_pool , session -> session_url_str ) ; if ( strcmp ( repos_root_url , session -> session_url_str ) != 0 ) { reparent_uri = session_uri ; SVN_ERR ( svn_ra_serf__reparent ( ra_session , repos_root_url , scratch_pool ) ) ; } err = get_iprops_via_more_requests ( ra_session , iprops , session_uri , path , revision , result_pool , scratch_pool ) ; if ( reparent_uri ) err = svn_error_compose_create ( err , svn_ra_serf__reparent ( ra_session , reparent_uri , scratch_pool ) ) ; return svn_error_trace ( err ) ; } SVN_ERR ( svn_ra_serf__get_stable_url ( & req_url , NULL , session , NULL , revision , scratch_pool , scratch_pool ) ) ; SVN_ERR_ASSERT ( session -> repos_root_str ) ; iprops_ctx = apr_pcalloc ( scratch_pool , sizeof ( * iprops_ctx ) ) ; iprops_ctx -> repos_root_url = session -> repos_root_str ; iprops_ctx -> pool = result_pool ; iprops_ctx -> curr_propname = svn_stringbuf_create_empty ( scratch_pool ) ; iprops_ctx -> curr_iprop = NULL ; iprops_ctx -> iprops = apr_array_make ( result_pool , 1 , sizeof ( svn_prop_inherited_item_t * ) ) ; iprops_ctx -> path = path ; iprops_ctx -> revision = revision ; xmlctx = svn_ra_serf__xml_context_create ( iprops_table , iprops_opened , iprops_closed , NULL , iprops_ctx , scratch_pool ) ; handler = svn_ra_serf__create_expat_handler ( session , xmlctx , NULL , scratch_pool ) ; handler -> method = " " ; handler -> path = req_url ; handler -> body_delegate = create_iprops_body ; handler -> body_delegate_baton = iprops_ctx ; handler -> body_type = " " ; SVN_ERR ( svn_ra_serf__context_run_one ( handler , scratch_pool ) ) ; if ( handler -> sline . code != 200 ) return svn_error_trace ( svn_ra_serf__unexpected_status ( handler ) ) ; * iprops = iprops_ctx -> iprops ; return SVN_NO_ERROR ; }
Request a inherited-props-report from the URL attached to RA_SESSION,
and fill the IPROPS array hash with the results.
Request a inherited - props - report from the URL attached to RA_SESSION and fill the IPROPS array hash with the results .
/* latest_revnum */ /* url */