You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/02/24 15:10:54 UTC
svn commit: r1449482 - in /subversion/trunk/subversion: include/ libsvn_wc/
Author: rhuijben
Date: Sun Feb 24 14:10:53 2013
New Revision: 1449482
URL: http://svn.apache.org/r1449482
Log:
Deprecate svn_wc_read_kind() to add an additional argument, which makes this
function directly usable to answer the questions 'is there an in-wc node here?'
and 'can I add a new node here?' for libsvn_client.
Currently almost every caller of this function in libsvn_client needs to call
another node function before it can do its actual work, because it misses
essential information.
* subversion/include/svn_wc.h
(svn_wc_read_kind2): New function.
(svn_wc_read_kind): Deprecate function.
* subversion/libsvn_wc/adm_crawler.c
(svn_wc__internal_transmit_prop_deltas): Update caller. Provide proper error
when used on invalid nodes.
* subversion/libsvn_wc/conflicts.c
(generate_propconflict): Update caller. Provide proper error
when used on invalid nodes.
* subversion/libsvn_wc/deprecated.c
(svn_wc_add3): Update caller.
(svn_wc_read_kind): New function.
* subversion/libsvn_wc/diff_local.c
(svn_wc_diff6): Update caller.
* subversion/libsvn_wc/lock.c
(svn_wc_adm_retrieve,
svn_wc_adm_probe_retrieve): Update caller.
* subversion/libsvn_wc/node.c
(svn_wc_read_kind): Rename to ...
(svn_wc_read_kind2): ... this. Add argument and change return type.
* subversion/libsvn_wc/revert.c
(revert_partial): Update caller.
* subversion/libsvn_wc/util.c
(svn_wc__fetch_kind_func): Update caller.
* subversion/libsvn_wc/wc_db.c
(svn_wc__db_read_kind): Handle show_deleted.
* subversion/libsvn_wc/wc_db.h
(svn_wc__db_read_kind): Add show_deleted argument and update
documentation.
Modified:
subversion/trunk/subversion/include/svn_wc.h
subversion/trunk/subversion/libsvn_wc/adm_crawler.c
subversion/trunk/subversion/libsvn_wc/conflicts.c
subversion/trunk/subversion/libsvn_wc/deprecated.c
subversion/trunk/subversion/libsvn_wc/diff_local.c
subversion/trunk/subversion/libsvn_wc/lock.c
subversion/trunk/subversion/libsvn_wc/node.c
subversion/trunk/subversion/libsvn_wc/revert.c
subversion/trunk/subversion/libsvn_wc/util.c
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/libsvn_wc/wc_db.h
Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1449482&r1=1449481&r2=1449482&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Sun Feb 24 14:10:53 2013
@@ -8104,16 +8104,28 @@ svn_wc_exclude(svn_wc_context_t *wc_ctx,
/** @} */
/**
- * Set @a kind to the #svn_node_kind_t of @a abspath. Use @a wc_ctx
- * to access the working copy, and @a scratch_pool for all temporary
- * allocations.
- *
- * If @a abspath is not under version control, set @a kind to #svn_node_none.
- * If it is versioned but hidden and @a show_hidden is @c FALSE, also return
- * #svn_node_none.
+ * Set @a kind to the #svn_kind_t of @a abspath. Use @a wc_ctx to access
+ * the working copy, and @a scratch_pool for all temporary allocations.
*
- * ### What does hidden really mean?
- * ### What happens when show_hidden is TRUE?
+ * If @a abspath is not under version control, set @a kind to #svn_kind_none.
+ *
+ * If @a show_hidden and @a show_deleted are both @c FALSE, the kind of
+ * scheduled for delete, administrative only 'not present' and excluded
+ * nodes is reported as #svn_kind_node. This is recommended as a check for
+ * 'is there a versioned file or directory here?'
+ *
+ * If @a show_deleted is FALSE, but @a show_hidden is @c TRUE then only
+ * scheduled for delete and administrative only 'not present' nodes are
+ * reported as #svn_kind_none. This is recommended as check for
+ * 'Can I add a node here?'
+ *
+ * If @a show_deleted is TRUE, but @a show_hidden is FALSE, then only
+ * administrative only 'not present' nodes and excluded nodes are reported as
+ * #svn_kind_none. This behavior is the behavior bescribed as 'hidden'
+ * before Subversion 1.7.
+ *
+ * If @a show_hidden and @a show_deleted are both @c TRUE all nodes are
+ * reported.
*
* If the node's info is incomplete, it may or may not have a known node kind
* set. If the kind is not known (yet), set @a kind to #svn_node_unknown.
@@ -8122,6 +8134,21 @@ svn_wc_exclude(svn_wc_context_t *wc_ctx,
* @since New in 1.7.
*/
svn_error_t *
+svn_wc_read_kind2(svn_kind_t *kind,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ svn_boolean_t show_deleted,
+ svn_boolean_t show_hidden,
+ apr_pool_t *scratch_pool);
+
+/** Similar to svn_wc_read_kind2() but always shows deleted nodes and returns
+ * the result as a #svn_node_kind_t.
+ *
+ * @since New in 1.7.
+ * @deprecated Provided for backward compatibility with the 1.7 API.
+ */
+SVN_DEPRECATED
+svn_error_t *
svn_wc_read_kind(svn_node_kind_t *kind,
svn_wc_context_t *wc_ctx,
const char *abspath,
Modified: subversion/trunk/subversion/libsvn_wc/adm_crawler.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_crawler.c?rev=1449482&r1=1449481&r2=1449482&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_crawler.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_crawler.c Sun Feb 24 14:10:53 2013
@@ -1207,9 +1207,15 @@ svn_wc__internal_transmit_prop_deltas(sv
SVN_ERR(svn_wc__db_read_kind(&kind, db, local_abspath,
FALSE /* allow_missing */,
+ FALSE /* show_deleted */,
FALSE /* show_hidden */,
iterpool));
+ if (kind == svn_kind_none)
+ return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
+ _("The node '%s' was not found."),
+ svn_dirent_local_style(local_abspath, iterpool));
+
/* Get an array of local changes by comparing the hashes. */
SVN_ERR(svn_wc__internal_propdiff(&propmods, NULL, db, local_abspath,
scratch_pool, iterpool));
Modified: subversion/trunk/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.c?rev=1449482&r1=1449481&r2=1449482&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Sun Feb 24 14:10:53 2013
@@ -1286,9 +1286,18 @@ generate_propconflict(svn_boolean_t *con
svn_kind_t kind;
const svn_string_t *new_value = NULL;
- SVN_ERR(svn_wc__db_read_kind(&kind, db, local_abspath, FALSE, FALSE,
+ SVN_ERR(svn_wc__db_read_kind(&kind, db, local_abspath,
+ FALSE /* allow_missing */,
+ FALSE /* show_deleted */,
+ FALSE /* show_hidden */,
scratch_pool));
+ if (kind == svn_kind_none)
+ return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
+ _("The node '%s' was not found."),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
+
cdesc = svn_wc_conflict_description_create_prop2(
local_abspath,
(kind == svn_kind_dir) ? svn_node_dir : svn_node_file,
Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=1449482&r1=1449481&r2=1449482&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_wc/deprecated.c Sun Feb 24 14:10:53 2013
@@ -974,6 +974,7 @@ svn_wc_add3(const char *path,
SVN_ERR(svn_wc__db_read_kind(&kind, wc_db, local_abspath,
FALSE /* allow_missing */,
+ TRUE /* show_deleted */,
FALSE /* show_hidden */, pool));
if (kind == svn_kind_dir)
{
@@ -4565,3 +4566,28 @@ svn_wc_move(svn_wc_context_t *wc_ctx,
notify_func, notify_baton,
scratch_pool));
}
+
+svn_error_t *
+svn_wc_read_kind(svn_node_kind_t *kind,
+ svn_wc_context_t *wc_ctx,
+ const char *abspath,
+ svn_boolean_t show_hidden,
+ apr_pool_t *scratch_pool)
+{
+ svn_kind_t db_kind;
+
+ SVN_ERR(svn_wc_read_kind2(&db_kind,
+ wc_ctx, abspath,
+ TRUE /* show_deleted */,
+ show_hidden,
+ scratch_pool));
+
+ if (db_kind == svn_kind_dir)
+ *kind = svn_node_dir;
+ else if (db_kind == svn_kind_file || db_kind == svn_kind_symlink)
+ *kind = svn_node_file;
+ else
+ *kind = svn_node_none;
+
+ return SVN_NO_ERROR;
+}
Modified: subversion/trunk/subversion/libsvn_wc/diff_local.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/diff_local.c?rev=1449482&r1=1449481&r2=1449482&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/diff_local.c (original)
+++ subversion/trunk/subversion/libsvn_wc/diff_local.c Sun Feb 24 14:10:53 2013
@@ -446,6 +446,7 @@ svn_wc_diff6(svn_wc_context_t *wc_ctx,
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
SVN_ERR(svn_wc__db_read_kind(&kind, wc_ctx->db, local_abspath,
FALSE /* allow_missing */,
+ TRUE /* show_deleted */,
FALSE /* show_hidden */,
scratch_pool));
Modified: subversion/trunk/subversion/libsvn_wc/lock.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/lock.c?rev=1449482&r1=1449481&r2=1449482&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/lock.c (original)
+++ subversion/trunk/subversion/libsvn_wc/lock.c Sun Feb 24 14:10:53 2013
@@ -924,6 +924,7 @@ svn_wc_adm_retrieve(svn_wc_adm_access_t
err = svn_wc__db_read_kind(&kind, svn_wc__adm_get_db(associated),
local_abspath,
TRUE /* allow_missing */,
+ TRUE /* show_deleted */,
FALSE /* show_hidden */, pool);
if (err)
@@ -985,7 +986,9 @@ svn_wc_adm_probe_retrieve(svn_wc_adm_acc
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
SVN_ERR(svn_wc__db_read_kind(&kind, associated->db, local_abspath,
- TRUE /* allow_missing */, FALSE /* show_hidden*/,
+ TRUE /* allow_missing */,
+ TRUE /* show_deleted */,
+ FALSE /* show_hidden*/,
pool));
if (kind == svn_kind_dir)
@@ -1523,6 +1526,7 @@ svn_wc__acquire_write_lock(const char **
svn_kind_t parent_kind;
err = svn_wc__db_read_kind(&parent_kind, db, parent_abspath,
TRUE /* allow_missing */,
+ TRUE /* show_deleted */,
FALSE /* show_hidden */,
scratch_pool);
if (err && SVN_WC__ERR_IS_NOT_CURRENT_WC(err))
Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=1449482&r1=1449481&r2=1449482&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Sun Feb 24 14:10:53 2013
@@ -292,26 +292,20 @@ convert_db_kind_to_node_kind(svn_node_ki
}
svn_error_t *
-svn_wc_read_kind(svn_node_kind_t *kind,
+svn_wc_read_kind2(svn_kind_t *kind,
svn_wc_context_t *wc_ctx,
const char *local_abspath,
+ svn_boolean_t show_deleted,
svn_boolean_t show_hidden,
apr_pool_t *scratch_pool)
{
- svn_kind_t db_kind;
-
- SVN_ERR(svn_wc__db_read_kind(&db_kind,
- wc_ctx->db, local_abspath, TRUE, show_hidden,
- scratch_pool));
-
- if (db_kind == svn_kind_dir)
- *kind = svn_node_dir;
- else if (db_kind == svn_kind_file || db_kind == svn_kind_symlink)
- *kind = svn_node_file;
- else
- *kind = svn_node_none;
-
- return SVN_NO_ERROR;
+ return svn_error_trace(
+ svn_wc__db_read_kind(kind,
+ wc_ctx->db, local_abspath,
+ TRUE /* allow_missing */,
+ show_deleted,
+ show_hidden,
+ scratch_pool));
}
svn_error_t *
Modified: subversion/trunk/subversion/libsvn_wc/revert.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/revert.c?rev=1449482&r1=1449481&r2=1449482&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/revert.c (original)
+++ subversion/trunk/subversion/libsvn_wc/revert.c Sun Feb 24 14:10:53 2013
@@ -815,6 +815,7 @@ revert_partial(svn_wc__db_t *db,
SVN_ERR(svn_wc__db_read_kind(&kind, db, child_abspath,
FALSE /* allow_missing */,
+ TRUE /* show_deleted */,
FALSE /* show_hidden */,
iterpool));
if (kind != svn_kind_file)
Modified: subversion/trunk/subversion/libsvn_wc/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/util.c?rev=1449482&r1=1449481&r2=1449482&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/util.c (original)
+++ subversion/trunk/subversion/libsvn_wc/util.c Sun Feb 24 14:10:53 2013
@@ -554,6 +554,7 @@ svn_wc__fetch_kind_func(svn_kind_t *kind
SVN_ERR(svn_wc__db_read_kind(kind, sfb->db, local_abspath,
FALSE /* allow_missing */,
+ TRUE /* show_deleted */,
FALSE /* show_hidden */,
scratch_pool));
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1449482&r1=1449481&r2=1449482&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Sun Feb 24 14:10:53 2013
@@ -12999,6 +12999,7 @@ svn_wc__db_read_kind(svn_kind_t *kind,
svn_wc__db_t *db,
const char *local_abspath,
svn_boolean_t allow_missing,
+ svn_boolean_t show_deleted,
svn_boolean_t show_hidden,
apr_pool_t *scratch_pool)
{
@@ -13037,22 +13038,39 @@ svn_wc__db_read_kind(svn_kind_t *kind,
}
}
- if (!show_hidden)
+ if (!(show_deleted && show_hidden))
{
int op_depth = svn_sqlite__column_int(stmt_info, 0);
+ svn_boolean_t report_none = FALSE;
svn_wc__db_status_t status = svn_sqlite__column_token(stmt_info, 3,
presence_map);
if (op_depth > 0)
SVN_ERR(convert_to_working_status(&status, status));
- if (status == svn_wc__db_status_not_present
- || status == svn_wc__db_status_excluded
- || status == svn_wc__db_status_server_excluded)
+ switch (status)
+ {
+ case svn_wc__db_status_not_present:
+ if (! (show_hidden && show_deleted))
+ report_none = TRUE;
+ break;
+ case svn_wc__db_status_excluded:
+ case svn_wc__db_status_server_excluded:
+ if (! show_hidden)
+ report_none = TRUE;
+ break;
+ case svn_wc__db_status_deleted:
+ if (! show_deleted)
+ report_none = TRUE;
+ break;
+ default:
+ break;
+ }
+
+ if (report_none)
{
*kind = svn_kind_none;
- SVN_ERR(svn_sqlite__reset(stmt_info));
- return SVN_NO_ERROR;
+ return svn_error_trace(svn_sqlite__reset(stmt_info));
}
}
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1449482&r1=1449481&r2=1449482&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Sun Feb 24 14:10:53 2013
@@ -2270,8 +2270,18 @@ svn_wc__db_read_conflict(svn_skel_t **co
If the node is missing and ALLOW_MISSING is FALSE, then it will return
SVN_ERR_WC_PATH_NOT_FOUND.
- If SHOW_HIDDEN is FALSE and the status of LOCAL_ABSPATH is NOT_PRESENT or
- EXCLUDED, set KIND to svn_kind_none.
+ The SHOW_HIDDEN and SHOW_DELETED flags report certain states as kind none.
+
+ When nodes have certain statee they are only reported when:
+ svn_wc__db_status_not_present when show_hidden && show_deleted
+
+ svn_wc__db_status_excluded when show_hidden
+ svn_wc__db_status_server_excluded when show_hidden
+
+ svn_wc__db_status_deleted when show_deleted
+
+ In other cases these nodes are reported with *KIND as svn_kind_none.
+ (See also svn_wc_read_kind2()'s documentation)
Uses SCRATCH_POOL for temporary allocations. */
svn_error_t *
@@ -2279,6 +2289,7 @@ svn_wc__db_read_kind(svn_kind_t *kind,
svn_wc__db_t *db,
const char *local_abspath,
svn_boolean_t allow_missing,
+ svn_boolean_t show_deleted,
svn_boolean_t show_hidden,
apr_pool_t *scratch_pool);