You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2010/06/25 15:23:59 UTC
svn commit: r957936 - in /subversion/trunk/subversion:
include/private/svn_wc_private.h libsvn_wc/node.c
Author: dannas
Date: Fri Jun 25 13:23:59 2010
New Revision: 957936
URL: http://svn.apache.org/viewvc?rev=957936&view=rev
Log:
Add function for fetching repos_relpath in libsvn_client.
For motivation, I borrow what Bert said on IRC:
Bert> New apis should start using repos_root, repos_relpath
pairs as that reduces escaping issues.
<Bert>(And in most cases you only need the repos_relpath
anyway, as an ra session is always rooted on or below
the repos_root)
* subversion/include/private/svn_wc_private.h
(svn_wc__node_get_repos_relpath): New.
* subversion/libsvn_wc/node.c
(svn_wc__node_get_repos_relpath): New.
Modified:
subversion/trunk/subversion/include/private/svn_wc_private.h
subversion/trunk/subversion/libsvn_wc/node.c
Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=957936&r1=957935&r2=957936&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Fri Jun 25 13:23:59 2010
@@ -349,6 +349,20 @@ svn_wc__node_get_url(const char **url,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
+/**
+ * Set @a *repos_relpath to the corresponding repos_relpath for @a
+ * local_abspath, using @a wc_ctx. If the node is added, return the
+ * repos_relpath it will have in the repository.
+ *
+ * If @a local_abspath is not in the working copy, return @c
+ * SVN_ERR_WC_PATH_NOT_FOUND.
+ * */
+svn_error_t *
+svn_wc__node_get_repos_relpath(const char **repos_relpath,
+ const char *local_abspath,
+ svn_wc_context_t *wc_ctx,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/**
* Set @a *copyfrom_url to the corresponding copy-from URL (allocated
Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=957936&r1=957935&r2=957936&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Fri Jun 25 13:23:59 2010
@@ -401,6 +401,73 @@ svn_wc__node_get_url(const char **url,
result_pool, scratch_pool));
}
+/* ### This is essentially a copy-paste of svn_wc__internal_get_url().
+ * ### If we decide to keep this one, then it should be rewritten to avoid
+ * ### code duplication.*/
+svn_error_t *
+svn_wc__node_get_repos_relpath(const char **repos_relpath,
+ const char *local_abspath,
+ svn_wc_context_t *wc_ctx,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ svn_wc__db_status_t status;
+ svn_boolean_t have_base;
+
+ SVN_ERR(svn_wc__db_read_info(&status, NULL, NULL, repos_relpath,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, &have_base, NULL, NULL, NULL,
+ wc_ctx->db, local_abspath,
+ scratch_pool, scratch_pool));
+ if (*repos_relpath == NULL)
+ {
+ if (status == svn_wc__db_status_normal
+ || status == svn_wc__db_status_incomplete
+ || (have_base
+ && (status == svn_wc__db_status_deleted
+ || status == svn_wc__db_status_obstructed_delete)))
+ {
+ SVN_ERR(svn_wc__db_scan_base_repos(repos_relpath, NULL,
+ NULL,
+ wc_ctx->db, local_abspath,
+ scratch_pool, scratch_pool));
+ }
+ else if (status == svn_wc__db_status_added)
+ {
+ SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, repos_relpath,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ wc_ctx->db, local_abspath,
+ scratch_pool, scratch_pool));
+ }
+ else if (status == svn_wc__db_status_absent
+ || status == svn_wc__db_status_excluded
+ || status == svn_wc__db_status_not_present
+ || (!have_base
+ && (status == svn_wc__db_status_deleted
+ || status == svn_wc__db_status_obstructed_delete)))
+ {
+ const char *parent_abspath;
+
+ svn_dirent_split(local_abspath, &parent_abspath, repos_relpath,
+ scratch_pool);
+ SVN_ERR(svn_wc__node_get_repos_relpath(repos_relpath, wc_ctx,
+ parent_abspath,
+ scratch_pool,
+ scratch_pool));
+ }
+ else
+ {
+ /* Status: obstructed, obstructed_add */
+ *repos_relpath = NULL;
+ return SVN_NO_ERROR;
+ }
+ }
+
+ return SVN_NO_ERROR;
+}
+
svn_error_t *
svn_wc__node_get_copyfrom_info(const char **copyfrom_url,
svn_revnum_t *copyfrom_rev,