Author: rhuijben
Date: Tue Aug 3 10:20:57 2010
New Revision: 981807
URL: http://svn.apache.org/viewvc?rev=981807&view=rev
Log:
Don't assume that every node that has a record in a single-db database
is a working copy root. This resolves the regression that you can't
checkout a new working copy over a deleted node in single-db.
(So this fixes copy_tests.py 21 for single-db).
Before this patch the wc-db did a simple check to see if a row
existed for the directory node, but this is not the task of the wc-db
layer (which should just return the relevant wcroot info for a working
copy).
This patch moves this check to svn_wc__internal_check_wc().
* subversion/libsvn_wc/adm_files.c
(svn_wc__internal_ensure_adm): Update caller. Passing TRUE here fixes
copy-tests.py 21 for us.
* subversion/libsvn_wc/lock.c
(svn_wc__internal_check_wc): In single-db mode, verify if the directory
is really part of the wc-ng working copy, or if it just some node
below a wcroot.
(svn_wc_check_wc2): Update caller, passing false for compatibility with
before this patch. Add todo marker.
(probe,
open_single): Update callers, passing FALSE to allow locking missing
nodes.
* subversion/libsvn_wc/lock.h
(svn_wc__internal_check_wc): Update prototype.
* subversion/libsvn_wc/log.c
(can_be_cleaned): Update caller.
* subversion/libsvn_wc/wc_db.c
(svn_wc__db_temp_get_format): Remove single-db root test.
Modified:
subversion/trunk/subversion/libsvn_wc/adm_files.c
subversion/trunk/subversion/libsvn_wc/lock.c
subversion/trunk/subversion/libsvn_wc/lock.h
subversion/trunk/subversion/libsvn_wc/log.c
subversion/trunk/subversion/libsvn_wc/wc_db.c
Modified: subversion/trunk/subversion/libsvn_wc/adm_files.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.c?rev=981807&r1=981806&r2=981807&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.c Tue Aug 3 10:20:57 2010
@@ -609,7 +609,8 @@ svn_wc__internal_ensure_adm(svn_wc__db_t
SVN_ERR_ASSERT(repos_uuid != NULL);
SVN_ERR_ASSERT(svn_uri_is_ancestor(repos_root_url, url));
- SVN_ERR(svn_wc__internal_check_wc(&format, db, local_abspath, scratch_pool));
+ SVN_ERR(svn_wc__internal_check_wc(&format, db, local_abspath, TRUE,
+ scratch_pool));
repos_relpath = svn_uri_is_child(repos_root_url, url, scratch_pool);
if (repos_relpath == NULL)
Modified: subversion/trunk/subversion/libsvn_wc/lock.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/lock.c?rev=981807&r1=981806&r2=981807&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/lock.c (original)
+++ subversion/trunk/subversion/libsvn_wc/lock.c Tue Aug 3 10:20:57 2010
@@ -109,6 +109,7 @@ svn_error_t *
svn_wc__internal_check_wc(int *wc_format,
svn_wc__db_t *db,
const char *local_abspath,
+ svn_boolean_t check_path,
apr_pool_t *scratch_pool)
{
svn_error_t *err;
@@ -143,6 +144,68 @@ svn_wc__internal_check_wc(int *wc_format
}
}
+#ifdef SVN_WC__SINGLE_DB
+ if (*wc_format >= SVN_WC__WC_NG_VERSION)
+ {
+ svn_error_t *err;
+ svn_wc__db_status_t db_status;
+ svn_wc__db_kind_t db_kind;
+
+ if (check_path)
+ {
+ /* If a node is not a directory, it is not a working copy
directory.
+ This allows creating new working copies as a path below an
existing
+ working copy.
+ */
+ svn_node_kind_t wc_kind;
+
+ SVN_ERR(svn_io_check_path(local_abspath, &wc_kind, scratch_pool));
+ if (wc_kind != svn_node_dir)
+ {
+ *wc_format = 0; /* Not a directory, so not a wc-directory */
+ return SVN_NO_ERROR;
+ }
+ }
+
+ err = svn_wc__db_read_info(&db_status, &db_kind, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ db, local_abspath,
+ scratch_pool, scratch_pool);
+
+ if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
+ {
+ svn_error_clear(err);
+ *wc_format = 0;
+ return SVN_NO_ERROR;
+ }
+ else
+ SVN_ERR(err);
+
+ if (db_kind != svn_wc__db_kind_dir)
+ {
+ /* The WC thinks there must be a file, so this is not
+ a wc-directory */
+ *wc_format = 0;
+ return SVN_NO_ERROR;
+ }
+
+ switch (db_status)
+ {
+ case svn_wc__db_status_not_present:
+ case svn_wc__db_status_absent:
+ case svn_wc__db_status_excluded:
+ /* If there is a directory here, it is not related to the parent
+ working copy: Obstruction */
+ *wc_format = 0;
+ return SVN_NO_ERROR;
+ default:
+ break;
+ }
+ }
+#endif
+
return SVN_NO_ERROR;
}
@@ -151,10 +214,13 @@ svn_error_t *
svn_wc_check_wc2(int *wc_format,
svn_wc_context_t *wc_ctx,
const char *local_abspath,
- apr_pool_t *pool)
+ apr_pool_t *scratch_pool)
{
+ /* ### Should we pass TRUE for check_path to find obstructions and
+ missing directories? */
return svn_error_return(
- svn_wc__internal_check_wc(wc_format, wc_ctx->db, local_abspath, pool));
+ svn_wc__internal_check_wc(wc_format, wc_ctx->db, local_abspath, FALSE,
+ scratch_pool));
}
@@ -422,7 +488,8 @@ probe(svn_wc__db_t *db,
const char *local_abspath;
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
- SVN_ERR(svn_wc__internal_check_wc(&wc_format, db, local_abspath, pool));
+ SVN_ERR(svn_wc__internal_check_wc(&wc_format, db, local_abspath,
+ FALSE, pool));
}
/* a "version" of 0 means a non-wc directory */
@@ -469,7 +536,8 @@ open_single(svn_wc_adm_access_t **adm_ac
svn_wc_adm_access_t *lock;
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, scratch_pool));
- err = svn_wc__internal_check_wc(&wc_format, db, local_abspath, scratch_pool);
+ err = svn_wc__internal_check_wc(&wc_format, db, local_abspath, FALSE,
+ scratch_pool);
if (wc_format == 0 || (err && APR_STATUS_IS_ENOENT(err->apr_err)))
{
return svn_error_createf(SVN_ERR_WC_NOT_WORKING_COPY, err,
@@ -1599,7 +1667,7 @@ acquire_locks_recursively(svn_wc_context
{
/* We don't want to try and lock an unversioned directory that
obstructs a versioned directory. */
- err = svn_wc__internal_check_wc(&format, wc_ctx->db, local_abspath,
+ err = svn_wc__internal_check_wc(&format, wc_ctx->db, local_abspath,
FALSE,
iterpool);
if (!err && format)
Modified: subversion/trunk/subversion/libsvn_wc/lock.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/lock.h?rev=981807&r1=981806&r2=981807&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/lock.h (original)
+++ subversion/trunk/subversion/libsvn_wc/lock.h Tue Aug 3 10:20:57 2010
@@ -91,11 +91,14 @@ svn_wc__adm_retrieve_internal2(svn_wc__d
/* ### this is probably bunk. but I dunna want to trace backwards-compat
### users of svn_wc_check_wc(). probably gonna be rewritten for wc-ng
- ### in any case. */
+ ### in any case.
+
+ If CHECK_PATH is TRUE, a not-existing directory is not a working copy */
svn_error_t *
svn_wc__internal_check_wc(int *wc_format,
svn_wc__db_t *db,
const char *local_abspath,
+ svn_boolean_t check_path,
apr_pool_t *scratch_pool);
Modified: subversion/trunk/subversion/libsvn_wc/log.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/log.c?rev=981807&r1=981806&r2=981807&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/log.c (original)
+++ subversion/trunk/subversion/libsvn_wc/log.c Tue Aug 3 10:20:57 2010
@@ -469,7 +469,7 @@ can_be_cleaned(int *wc_format,
apr_pool_t *scratch_pool)
{
SVN_ERR(svn_wc__internal_check_wc(wc_format, db,
- local_abspath, scratch_pool));
+ local_abspath, FALSE, scratch_pool));
/* a "version" of 0 means a non-wc directory */
if (*wc_format == 0)
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=981807&r1=981806&r2=981807&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Aug 3 10:20:57 2010
@@ -7280,28 +7280,6 @@ svn_wc__db_temp_get_format(int *format,
SVN_ERR_ASSERT(pdh->wcroot != NULL);
}
-#ifdef SVN_WC__SINGLE_DB
- {
- const char *local_relpath =
svn_dirent_skip_ancestor(pdh->wcroot->abspath,
- local_dir_abspath);
- if (*local_relpath != '\0')
- {
- svn_boolean_t base, working;
-
- SVN_ERR(which_trees_exist(&base, &working, pdh->wcroot->sdb,
- pdh->wcroot->wc_id, local_relpath));
- if (!base && !working)
- {
- *format = 0;
- return svn_error_createf(SVN_ERR_WC_MISSING, NULL,
- _("'%s' is not a working copy"),
-
svn_dirent_local_style(local_dir_abspath,
- scratch_pool));
- }
- }
- }
-#endif
-
SVN_ERR_ASSERT(pdh->wcroot->format >= 1);
*format = pdh->wcroot->format;