You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2010/05/10 01:58:05 UTC
svn commit: r942632 - in /subversion/trunk/subversion/libsvn_wc: wc_db.c
wc_db.h
Author: gstein
Date: Sun May 9 23:58:05 2010
New Revision: 942632
URL: http://svn.apache.org/viewvc?rev=942632&view=rev
Log:
Add helper functions for paths that are persisted to disk. Saving an
abspath to disk prevents moving a working copy.
* subversion/libsvn_wc/wc_db.h:
* subversion/libsvn_wc/wc_db.c:
(svn_wc__db_to_relpath, svn_wc__db_from_relpath): new functions
Modified:
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/libsvn_wc/wc_db.h
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=942632&r1=942631&r2=942632&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Sun May 9 23:58:05 2010
@@ -784,6 +784,8 @@ open_db(svn_sqlite__db_t **sdb,
*LOCAL_RELPATH will be allocated within RESULT_POOL. Temporary allocations
will be made in SCRATCH_POOL.
+ *PDH will be allocated within DB->STATE_POOL.
+
Certain internal structures will be allocated in DB->STATE_POOL.
*/
static svn_error_t *
@@ -1756,6 +1758,47 @@ svn_wc__db_init(svn_wc__db_t *db,
svn_error_t *
+svn_wc__db_to_relpath(const char **local_relpath,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ svn_wc__db_pdh_t *pdh;
+
+ SVN_ERR(parse_local_abspath(&pdh, local_relpath, db, local_abspath,
+ svn_sqlite__mode_readonly,
+ result_pool, scratch_pool));
+ VERIFY_USABLE_PDH(pdh);
+
+ return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
+svn_wc__db_from_relpath(const char **local_abspath,
+ svn_wc__db_t *db,
+ const char *wri_abspath,
+ const char *local_relpath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ svn_wc__db_pdh_t *pdh;
+ const char *unused_relpath;
+
+ SVN_ERR(parse_local_abspath(&pdh, &unused_relpath, db, wri_abspath,
+ svn_sqlite__mode_readonly,
+ scratch_pool, scratch_pool));
+ VERIFY_USABLE_PDH(pdh);
+
+ *local_abspath = svn_dirent_join(pdh->wcroot->abspath,
+ local_relpath,
+ result_pool);
+ return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
svn_wc__db_base_add_directory(svn_wc__db_t *db,
const char *local_abspath,
const char *repos_relpath,
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=942632&r1=942631&r2=942632&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Sun May 9 23:58:05 2010
@@ -369,6 +369,50 @@ svn_wc__db_init(svn_wc__db_t *db,
apr_pool_t *scratch_pool);
+/* Compute the LOCAL_RELPATH for the given LOCAL_ABSPATH.
+
+ The LOCAL_RELPATH is a relative path to the working copy's root. That
+ root will be located by this function, and the path will be relative to
+ that location. If LOCAL_ABSPATH is the wcroot directory, then "" will
+ be returned.
+
+ The LOCAL_RELPATH should ONLY be used for persisting paths to disk.
+ Those patsh should not be an abspath, otherwise the working copy cannot
+ be moved. The working copy library should not make these paths visible
+ in its API (which should all be abspaths), and it should not be using
+ relpaths for other processing.
+
+ LOCAL_RELPATH will be allocated in RESULT_POOL. All other (temporary)
+ allocations will be made in SCRATCH_POOL.
+
+ ### note: with per-dir .svn directories, these relpaths will effectively
+ ### be the basename. it gets interesting in single-db mode
+*/
+svn_error_t *
+svn_wc__db_to_relpath(const char **local_relpath,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+
+/* Compute the LOCAL_ABSPATH for a LOCAL_RELPATH located within the working
+ copy identified by WRI_ABSPATH.
+
+ This is the reverse of svn_wc__db_to_relpath. It should be used for
+ returning a persisted relpath back into an abspath.
+
+ LOCAL_ABSPATH will be allocated in RESULT_POOL. All other (temporary)
+ allocations will be made in SCRATCH_POOL.
+*/
+svn_error_t *
+svn_wc__db_from_relpath(const char **local_abspath,
+ svn_wc__db_t *db,
+ const char *wri_abspath,
+ const char *local_relpath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
/* @} */
/* Different kinds of trees