/* Set *FS_PATH_P to the absolute filesystem path associated with the URL built from SESSION's URL and REL_PATH (which is relative to session's URL. Use POOL for allocations. */ static svn_error_t * get_fs_path(const char **fs_path_p, svn_ra_session_t *session, const char *rel_path, apr_pool_t *pool) { const char *url, *fs_path; SVN_ERR(svn_ra_get_session_url(session, &url, pool)); SVN_ERR(svn_ra_get_path_relative_to_root(session, &fs_path, url, pool)); *fs_path_p = svn_fspath__canonicalize(svn_relpath_join(fs_path, rel_path, pool), pool); return SVN_NO_ERROR; }
svn_error_t * svn_client__path_relative_to_root(const char **rel_path, svn_wc_context_t *wc_ctx, const char *abspath_or_url, const char *repos_root, svn_boolean_t include_leading_slash, svn_ra_session_t *ra_session, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { const char *repos_relpath; /* If we have a WC path... */ if (! svn_path_is_url(abspath_or_url)) { /* ...fetch its entry, and attempt to get both its full URL and repository root URL. If we can't get REPOS_ROOT from the WC entry, we'll get it from the RA layer.*/ SVN_ERR(svn_wc__node_get_repos_relpath(&repos_relpath, wc_ctx, abspath_or_url, result_pool, scratch_pool)); SVN_ERR_ASSERT(repos_relpath != NULL); } /* Merge handling passes a root that is not the repos root */ else if (repos_root != NULL) { if (!svn_uri__is_ancestor(repos_root, abspath_or_url)) return svn_error_createf(SVN_ERR_CLIENT_UNRELATED_RESOURCES, NULL, _("URL '%s' is not a child of repository " "root URL '%s'"), abspath_or_url, repos_root); repos_relpath = svn_uri_skip_ancestor(repos_root, abspath_or_url, result_pool); } else { svn_error_t *err; SVN_ERR_ASSERT(ra_session != NULL); /* Ask the RA layer to create a relative path for us */ err = svn_ra_get_path_relative_to_root(ra_session, &repos_relpath, abspath_or_url, scratch_pool); if (err) { if (err->apr_err == SVN_ERR_RA_ILLEGAL_URL) return svn_error_createf(SVN_ERR_CLIENT_UNRELATED_RESOURCES, err, _("URL '%s' is not inside repository"), abspath_or_url); return svn_error_trace(err); } } if (include_leading_slash) *rel_path = apr_pstrcat(result_pool, "/", repos_relpath, NULL); else *rel_path = repos_relpath; return SVN_NO_ERROR; }