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 2010/06/17 12:40:31 UTC
svn commit: r955542 - in /subversion/trunk/subversion:
bindings/javahl/native/ include/ libsvn_client/ svn/
Author: rhuijben
Date: Thu Jun 17 10:40:30 2010
New Revision: 955542
URL: http://svn.apache.org/viewvc?rev=955542&view=rev
Log:
Introduce a new svn_client_status_t structure to separate the public
client status api from the implementation of status in libsvn_wc, to
allow further cleanup in libsvn_wc. Note that this libsvn_client
function still uses relative paths in its api to avoid breaking
third party code even more than necessary for removing entries.
* subversion/bindings/javahl/native/CreateJ.cpp
(CreateJ::Status): Update arguments and use new fields wherever possible.
* subversion/bindings/javahl/native/CreateJ.h
(CreateJ::Status): Update prototype.
* subversion/bindings/javahl/native/StatusCallback.cpp
(StatusCallback::callback,
StatusCallback::doStatus): Use svn_client_status_t.
* subversion/bindings/javahl/native/StatusCallback.h
(StatusCallback::callback,
StatusCallback::doStatus): Use svn_client_status_t.
* subversion/bindings/javahl/native/SVNClient.cpp
(SVNClient::status): Update caller.
* subversion/include/svn_client.h
(svn_client_status_t): New structure.
(svn_client_status_dup): New function.
(svn_client_status_func_t): New typedef.
(svn_client_status5): Reorder arguments to new standard and use
svn_client_status_func_t for the callback.
* subversion/libsvn_client/client.h
(svn_client__do_external_status): Reorder arguments and use
svn_client_status_func_t.
* subversion/libsvn_client/delete.c
(find_undeletables): Implement svn_client_status_func_t.
(svn_client__can_delete): Update caller.
* subversion/libsvn_client/deprecated.c
(status4_wrapper_func): Use compatibility code in libsvn_wc by using a
baton designed for this operation.
* subversion/libsvn_client/externals.c
(svn_client__do_external_status): Update arguments and caller.
* subversion/libsvn_client/status.c
(status_baton): Update type of callback.
(create_client_status): Add prototype.
(tweak_status): Convert result using create_client_status.
(svn_client_status5): Update argument ordering and callback type.
(svn_client_status_dup): New function.
(create_client_status): New function.
* subversion/svn/cl.h
(svn_cl__print_status,
svn_cl__print_status_xml): Update type of status.
* subversion/svn/status-cmd.c
(status_cache): Update callback type.
(print_status_normal_or_xml): Update stat type.
(print_status): Update stat type and use local_abspath from struct.
(svn_cl__status): Update caller.
* subversion/svn/status.c
(generate_switch_column_code): Update argument type.
(print_status, svn_cl__print_status_xml): Use client_status_t.
(svn_cl__print_status_xml): Use local abspath from struct.
Modified:
subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
subversion/trunk/subversion/bindings/javahl/native/CreateJ.h
subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
subversion/trunk/subversion/bindings/javahl/native/StatusCallback.cpp
subversion/trunk/subversion/bindings/javahl/native/StatusCallback.h
subversion/trunk/subversion/include/svn_client.h
subversion/trunk/subversion/libsvn_client/client.h
subversion/trunk/subversion/libsvn_client/delete.c
subversion/trunk/subversion/libsvn_client/deprecated.c
subversion/trunk/subversion/libsvn_client/externals.c
subversion/trunk/subversion/libsvn_client/status.c
subversion/trunk/subversion/svn/cl.h
subversion/trunk/subversion/svn/status-cmd.c
subversion/trunk/subversion/svn/status.c
Modified: subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp?rev=955542&r1=955541&r2=955542&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp Thu Jun 17 10:40:30 2010
@@ -350,7 +350,7 @@ CreateJ::Lock(const svn_lock_t *lock)
jobject
CreateJ::Status(svn_wc_context_t *wc_ctx, const char *local_abspath,
- const svn_wc_status3_t *status, apr_pool_t *pool)
+ const svn_client_status_t *status, apr_pool_t *pool)
{
JNIEnv *env = JNIUtil::getEnv();
@@ -425,7 +425,9 @@ CreateJ::Status(svn_wc_context_t *wc_ctx
jstring jChangelist = NULL;
if (status != NULL)
{
- jTextType = EnumMapper::mapStatusKind(status->text_status);
+ /* ### Node status is more like the old text_status, then the new text_status
+ ### Maybe this should be handled on the tigris/apache boundary */
+ jTextType = EnumMapper::mapStatusKind(status->node_status);
jPropType = EnumMapper::mapStatusKind(status->prop_status);
jRepositoryTextType = EnumMapper::mapStatusKind(
status->repos_text_status);
@@ -465,6 +467,16 @@ CreateJ::Status(svn_wc_context_t *wc_ctx
if (JNIUtil::isJavaExceptionThrown())
POP_AND_RETURN_NULL;
}
+
+ if (text_conflicted)
+ {
+ /* ### Fetch conflict marker files, still handled via svn_wc_entry_t */
+ }
+
+ if (prop_conflicted)
+ {
+ /* ### Fetch conflict marker file, still handled via svn_wc_entry_t */
+ }
}
jLock = CreateJ::Lock(status->repos_lock);
@@ -481,13 +493,46 @@ CreateJ::Status(svn_wc_context_t *wc_ctx
POP_AND_RETURN_NULL;
}
- jOODLastCmtRevision = status->ood_last_cmt_rev;
- jOODLastCmtDate = status->ood_last_cmt_date;
+ jOODLastCmtRevision = status->ood_changed_rev;
+ jOODLastCmtDate = status->ood_changed_date;
jOODKind = EnumMapper::mapNodeKind(status->ood_kind);
- jOODLastCmtAuthor = JNIUtil::makeJString(status->ood_last_cmt_author);
+ jOODLastCmtAuthor = JNIUtil::makeJString(status->ood_changed_author);
if (JNIUtil::isJavaExceptionThrown())
POP_AND_RETURN_NULL;
+ if (status->versioned)
+ {
+ jNodeKind = EnumMapper::mapNodeKind(status->kind);
+ jRevision = status->revision;
+ jLastChangedRevision = status->changed_rev;
+ jLastChangedDate = status->changed_date;
+ jLastCommitAuthor = JNIUtil::makeJString(status->changed_author);
+
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+
+ if (status->lock)
+ {
+ jLockToken = JNIUtil::makeJString(status->lock->token);
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+
+ jLockComment = JNIUtil::makeJString(status->lock->comment);
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+
+ jLockOwner = JNIUtil::makeJString(status->lock->owner);
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+
+ jLockCreationDate = status->lock->creation_date;
+ }
+
+ jChangelist = JNIUtil::makeJString(status->changelist);
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+ }
+
const svn_wc_entry_t *entry = NULL;
if (status->versioned)
@@ -508,15 +553,6 @@ CreateJ::Status(svn_wc_context_t *wc_ctx
if (entry != NULL)
{
- /* ### Some of these values are also available in status */
- jNodeKind = EnumMapper::mapNodeKind(entry->kind);
- jRevision = entry->revision;
- jLastChangedRevision = entry->cmt_rev;
- jLastChangedDate = entry->cmt_date;
- jLastCommitAuthor = JNIUtil::makeJString(entry->cmt_author);
- if (JNIUtil::isJavaExceptionThrown())
- POP_AND_RETURN_NULL;
-
jConflictNew = JNIUtil::makeJString(entry->conflict_new);
if (JNIUtil::isJavaExceptionThrown())
POP_AND_RETURN_NULL;
@@ -534,23 +570,6 @@ CreateJ::Status(svn_wc_context_t *wc_ctx
POP_AND_RETURN_NULL;
jRevisionCopiedFrom = entry->copyfrom_rev;
- jLockToken = JNIUtil::makeJString(entry->lock_token);
- if (JNIUtil::isJavaExceptionThrown())
- POP_AND_RETURN_NULL;
-
- jLockComment = JNIUtil::makeJString(entry->lock_comment);
- if (JNIUtil::isJavaExceptionThrown())
- POP_AND_RETURN_NULL;
-
- jLockOwner = JNIUtil::makeJString(entry->lock_owner);
- if (JNIUtil::isJavaExceptionThrown())
- POP_AND_RETURN_NULL;
-
- jLockCreationDate = entry->lock_creation_date;
-
- jChangelist = JNIUtil::makeJString(entry->changelist);
- if (JNIUtil::isJavaExceptionThrown())
- POP_AND_RETURN_NULL;
}
}
Modified: subversion/trunk/subversion/bindings/javahl/native/CreateJ.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CreateJ.h?rev=955542&r1=955541&r2=955542&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CreateJ.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CreateJ.h Thu Jun 17 10:40:30 2010
@@ -53,7 +53,7 @@ class CreateJ
static jobject
Status(svn_wc_context_t *wc_ctx, const char *local_abspath,
- const svn_wc_status3_t *status, apr_pool_t *pool);
+ const svn_client_status_t *status, apr_pool_t *pool);
static jobject
ClientNotifyInformation(const svn_wc_notify_t *notify, apr_pool_t *pool);
Modified: subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp?rev=955542&r1=955541&r2=955542&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp Thu Jun 17 10:40:30 2010
@@ -178,14 +178,14 @@ SVNClient::status(const char *path, svn_
rev.kind = svn_opt_revision_unspecified;
- SVN_JNI_ERR(svn_client_status5(&youngest, checkedPath.c_str(),
- &rev, StatusCallback::callback,
- callback,
+ SVN_JNI_ERR(svn_client_status5(&youngest, ctx, checkedPath.c_str(),
+ &rev,
depth,
getAll, onServer, noIgnore,
ignoreExternals,
changelists.array(requestPool),
- ctx, requestPool.pool()), );
+ StatusCallback::callback, callback,
+ requestPool.pool()), );
}
void SVNClient::username(const char *pi_username)
Modified: subversion/trunk/subversion/bindings/javahl/native/StatusCallback.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/StatusCallback.cpp?rev=955542&r1=955541&r2=955542&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/StatusCallback.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/StatusCallback.cpp Thu Jun 17 10:40:30 2010
@@ -51,7 +51,7 @@ StatusCallback::~StatusCallback()
svn_error_t *
StatusCallback::callback(void *baton,
const char *local_abspath,
- const svn_wc_status3_t *status,
+ const svn_client_status_t *status,
apr_pool_t *pool)
{
if (baton)
@@ -65,7 +65,7 @@ StatusCallback::callback(void *baton,
*/
svn_error_t *
StatusCallback::doStatus(const char *local_abspath,
- const svn_wc_status3_t *status,
+ const svn_client_status_t *status,
apr_pool_t *pool)
{
JNIEnv *env = JNIUtil::getEnv();
Modified: subversion/trunk/subversion/bindings/javahl/native/StatusCallback.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/StatusCallback.h?rev=955542&r1=955541&r2=955542&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/StatusCallback.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/StatusCallback.h Thu Jun 17 10:40:30 2010
@@ -44,12 +44,12 @@ class StatusCallback
static svn_error_t* callback(void *baton,
const char *local_abspath,
- const svn_wc_status3_t *status,
+ const svn_client_status_t *status,
apr_pool_t *pool);
protected:
svn_error_t *doStatus(const char *local_abspath,
- const svn_wc_status3_t *status,
+ const svn_client_status_t *status,
apr_pool_t *pool);
private:
Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=955542&r1=955541&r2=955542&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Thu Jun 17 10:40:30 2010
@@ -1843,6 +1843,183 @@ svn_client_commit(svn_client_commit_info
*/
/**
+ * Structure for holding the "status" of a working copy item.
+ *
+ * The item's entry data is in @a entry, augmented and possibly shadowed
+ * by the other fields. @a entry is @c NULL if this item is not under
+ * version control.
+ *
+ * @note Fields may be added to the end of this structure in future
+ * versions. Therefore, to preserve binary compatibility, users
+ * should not directly allocate structures of this type.
+ *
+ * @since New in 1.7.
+ */
+typedef struct svn_client_status_t
+{
+ /** The kind of node as recorded in the working copy */
+ svn_node_kind_t kind;
+
+ /** The absolute path to the node */
+ const char *local_abspath;
+
+ /** If the path is under version control, versioned is TRUE, otherwise
+ * FALSE. */
+ svn_boolean_t versioned;
+
+ /** Set to TRUE if the node is the victim of some kind of conflict. */
+ svn_boolean_t conflicted;
+
+ /** The status of the node, based on the restructuring changes and if the
+ * node has no restructuring changes the text and prop status. */
+ enum svn_wc_status_kind node_status;
+
+ /** The status of the text of the node, not including restructuring changes.
+ * Valid values are: svn_wc_status_none, svn_wc_status_normal,
+ * svn_wc_status_modified and svn_wc_status_conflicted. */
+ enum svn_wc_status_kind text_status;
+
+ /** The status of the entry's properties.
+ * Valid values are: svn_wc_status_none, svn_wc_status_normal,
+ * svn_wc_status_modified and svn_wc_status_conflicted. */
+ enum svn_wc_status_kind prop_status;
+
+ /** a node can be 'locked' if a working copy update is in progress or
+ * was interrupted. */
+ svn_boolean_t locked;
+
+ /** a file or directory can be 'copied' if it's scheduled for
+ * addition-with-history (or part of a subtree that is scheduled as such.).
+ */
+ svn_boolean_t copied;
+
+ /** Base revision. */
+ svn_revnum_t revision;
+
+ /** Last revision this was changed */
+ svn_revnum_t changed_rev;
+
+ /** Date of last commit. */
+ apr_time_t changed_date;
+
+ /** Last commit author of this item */
+ const char *changed_author;
+
+ /** The URL of the repository */
+ const char *repos_root_url;
+
+ /** The in-repository path relative to the repository root.
+ * Use svn_path_url_component2() to join this value to the
+ * repos_root_url to get the full URL.
+ */
+ const char *repos_relpath;
+
+ /** a file or directory can be 'switched' if the switch command has been
+ * used. If this is TRUE, then file_external will be FALSE.
+ */
+ svn_boolean_t switched;
+
+ /** If the item is a file that was added to the working copy with an
+ * svn:externals; if file_external is TRUE, then switched is always
+ * FALSE.
+ */
+ svn_boolean_t file_external;
+
+ /** The locally present lock. (Values of path, token, owner, comment and
+ * are available if a lock is present) */
+ const svn_lock_t *lock;
+
+ /** Which changelist this item is part of, or NULL if not part of any. */
+ const char *changelist;
+
+ /** The depth of the node as recorded in the working copy
+ * (#svn_depth_unknown for files or when no depth is recorded) */
+ svn_depth_t depth;
+
+ /**
+ * @defgroup svn_wc_status_ood WC out-of-date info from the repository
+ * @{
+ *
+ * When the working copy item is out-of-date compared to the
+ * repository, the following fields represent the state of the
+ * youngest revision of the item in the repository. If the working
+ * copy is not out of date, the fields are initialized as described
+ * below.
+ */
+
+ /** Set to the node kind of the youngest commit, or #svn_node_none
+ * if not out of date. */
+ svn_node_kind_t ood_kind;
+
+ /** The status of the node, based on the text status if the node has no
+ * restructuring changes */
+ enum svn_wc_status_kind repos_node_status;
+
+ /** The entry's text status in the repository. */
+ enum svn_wc_status_kind repos_text_status;
+
+ /** The entry's property status in the repository. */
+ enum svn_wc_status_kind repos_prop_status;
+
+ /** The entry's lock in the repository, if any. */
+ const svn_lock_t *repos_lock;
+
+ /** Set to the youngest committed revision, or #SVN_INVALID_REVNUM
+ * if not out of date. */
+ svn_revnum_t ood_changed_rev;
+
+ /** Set to the most recent commit date, or @c 0 if not out of date. */
+ apr_time_t ood_changed_date;
+
+ /** Set to the user name of the youngest commit, or @c NULL if not
+ * out of date or non-existent. Because a non-existent @c
+ * svn:author property has the same behavior as an out-of-date
+ * working copy, examine @c ood_last_cmt_rev to determine whether
+ * the working copy is out of date. */
+ const char *ood_changed_author;
+
+ /** @} */
+
+ /** Reserved for libsvn_clients internal use; this value is only to be used for
+ * libsvn_client backwards compatibility wrappers, This value may be NULL or
+ * to other data in future versions. */
+ const void *backwards_compatibility_baton;
+
+ /* NOTE! Please update svn_client_status_dup() when adding new fields here. */
+} svn_client_status_t;
+
+/**
+ * Return a duplicate of @a status, allocated in @a result_pool. No part of the new
+ * structure will be shared with @a status.
+ *
+ * @since New in 1.7.
+ */
+svn_client_status_t *
+svn_client_status_dup(const svn_client_status_t *status,
+ apr_pool_t *result_pool);
+
+/**
+ * A callback for reporting a @a status about @a local_abspath.
+ *
+ * @a baton is a closure object; it should be provided by the
+ * implementation, and passed by the caller.
+ *
+ * @a scratch_pool will be cleared between invocations to the callback.
+ *
+ * ### we might be revamping the status infrastructure, and this callback
+ * ### could totally disappear by the end of 1.7 development. however, we
+ * ### need to mark the STATUS parameter as "const" so that it is easier
+ * ### to reason about who/what can modify those structures.
+ *
+ * @since New in 1.7.
+ */
+typedef svn_error_t *(*svn_client_status_func_t)(
+ void *baton,
+ const char *path,
+ const svn_client_status_t *status,
+ apr_pool_t *scratch_pool);
+
+/**
* Given @a path to a working copy directory (or single file), call
* @a status_func/status_baton with a set of #svn_wc_status_t *
* structures which describe the status of @a path, and its children
@@ -1885,17 +2062,17 @@ svn_client_commit(svn_client_commit_info
*/
svn_error_t *
svn_client_status5(svn_revnum_t *result_rev,
+ svn_client_ctx_t *ctx,
const char *path,
const svn_opt_revision_t *revision,
- svn_wc_status_func4_t status_func,
- void *status_baton,
svn_depth_t depth,
svn_boolean_t get_all,
svn_boolean_t update,
svn_boolean_t no_ignore,
svn_boolean_t ignore_externals,
const apr_array_header_t *changelists,
- svn_client_ctx_t *ctx,
+ svn_client_status_func_t status_func,
+ void *status_baton,
apr_pool_t *scratch_pool);
/**
Modified: subversion/trunk/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=955542&r1=955541&r2=955542&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/client.h (original)
+++ subversion/trunk/subversion/libsvn_client/client.h Thu Jun 17 10:40:30 2010
@@ -1028,14 +1028,14 @@ svn_client__fetch_externals(apr_hash_t *
/* Perform status operations on each external in TRAVERSAL_INFO. All
other options are the same as those passed to svn_client_status(). */
svn_error_t *
-svn_client__do_external_status(apr_hash_t *external_defs,
- svn_wc_status_func4_t status_func,
- void *status_baton,
+svn_client__do_external_status(svn_client_ctx_t *ctx,
+ apr_hash_t *external_defs,
svn_depth_t depth,
svn_boolean_t get_all,
svn_boolean_t update,
svn_boolean_t no_ignore,
- svn_client_ctx_t *ctx,
+ svn_client_status_func_t status_func,
+ void *status_baton,
apr_pool_t *pool);
Modified: subversion/trunk/subversion/libsvn_client/delete.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/delete.c?rev=955542&r1=955541&r2=955542&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/delete.c (original)
+++ subversion/trunk/subversion/libsvn_client/delete.c Thu Jun 17 10:40:30 2010
@@ -45,16 +45,16 @@
/*** Code. ***/
-/* An svn_wc_status_func4_t callback function for finding
+/* An svn_client_status_func_t callback function for finding
status structures which are not safely deletable. */
static svn_error_t *
find_undeletables(void *baton,
const char *path,
- const svn_wc_status3_t *status,
+ const svn_client_status_t *status,
apr_pool_t *pool)
{
/* Check for error-ful states. */
- if (status->text_status == svn_wc_status_obstructed)
+ if (status->node_status == svn_wc_status_obstructed)
return svn_error_createf(SVN_ERR_NODE_UNEXPECTED_KIND, NULL,
_("'%s' is in the way of the resource "
"actually under version control"),
@@ -64,9 +64,9 @@ find_undeletables(void *baton,
_("'%s' is not under version control"),
svn_dirent_local_style(path, pool));
- else if ((status->text_status != svn_wc_status_normal
- && status->text_status != svn_wc_status_deleted
- && status->text_status != svn_wc_status_missing)
+ else if ((status->node_status != svn_wc_status_normal
+ && status->node_status != svn_wc_status_deleted
+ && status->node_status != svn_wc_status_missing)
||
(status->prop_status != svn_wc_status_none
&& status->prop_status != svn_wc_status_normal))
@@ -82,7 +82,7 @@ find_undeletables(void *baton,
svn_error_t *
svn_client__can_delete(const char *path,
svn_client_ctx_t *ctx,
- apr_pool_t *pool)
+ apr_pool_t *scratch_pool)
{
svn_opt_revision_t revision;
svn_boolean_t file_external;
@@ -90,21 +90,22 @@ svn_client__can_delete(const char *path,
revision.kind = svn_opt_revision_unspecified;
- SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
+ SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, scratch_pool));
/* A file external should not be deleted since the file external is
implemented as a switched file and it would delete the file the
file external is switched to, which is not the behavior the user
would probably want. */
SVN_ERR(svn_wc__node_is_file_external(&file_external, ctx->wc_ctx,
- local_abspath, pool));
+ local_abspath, scratch_pool));
if (file_external)
return svn_error_createf(SVN_ERR_WC_CANNOT_DELETE_FILE_EXTERNAL, NULL,
_("Cannot remove the file external at '%s'; "
"please propedit or propdel the svn:externals "
"description that created it"),
- svn_dirent_local_style(local_abspath, pool));
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
/* Use an infinite-depth status check to see if there's anything in
@@ -112,11 +113,12 @@ svn_client__can_delete(const char *path,
status callback function find_undeletables() makes the
determination, returning an error if it finds anything that shouldn't
be deleted. */
- return svn_error_return(svn_client_status5(NULL, path, &revision,
- find_undeletables, NULL,
+ return svn_error_return(svn_client_status5(NULL, ctx, path, &revision,
svn_depth_infinity, FALSE,
FALSE, FALSE, FALSE,
- NULL, ctx, pool));
+ NULL,
+ find_undeletables, NULL,
+ scratch_pool));
}
Modified: subversion/trunk/subversion/libsvn_client/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/deprecated.c?rev=955542&r1=955541&r2=955542&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_client/deprecated.c Thu Jun 17 10:40:30 2010
@@ -1432,18 +1432,20 @@ struct status4_wrapper_baton
void *old_baton;
};
+/* Implements svn_client_status_func_t */
static svn_error_t *
status4_wrapper_func(void *baton,
const char *path,
- const svn_wc_status3_t *status,
+ const svn_client_status_t *status,
apr_pool_t *scratch_pool)
{
struct status4_wrapper_baton *swb = baton;
svn_wc_status2_t *dup;
const char *local_abspath;
+ const svn_wc_status3_t *wc_status = status->backwards_compatibility_baton;
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, scratch_pool));
- SVN_ERR(svn_wc__status2_from_3(&dup, status, swb->wc_ctx,
+ SVN_ERR(svn_wc__status2_from_3(&dup, wc_status, swb->wc_ctx,
local_abspath, scratch_pool,
scratch_pool));
@@ -1468,9 +1470,9 @@ svn_client_status4(svn_revnum_t *result_
struct status4_wrapper_baton swb = { status_func, ctx->wc_ctx,
status_baton };
- return svn_client_status5(result_rev, path, revision, status4_wrapper_func,
- &swb, depth, get_all, update, no_ignore,
- ignore_externals, changelists, ctx, pool);
+ return svn_client_status5(result_rev, ctx, path, revision, depth, get_all,
+ update, no_ignore, ignore_externals, changelists,
+ status4_wrapper_func, &swb, pool);
}
struct status3_wrapper_baton
Modified: subversion/trunk/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=955542&r1=955541&r2=955542&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/externals.c (original)
+++ subversion/trunk/subversion/libsvn_client/externals.c Thu Jun 17 10:40:30 2010
@@ -1301,14 +1301,14 @@ svn_client__fetch_externals(apr_hash_t *
svn_error_t *
-svn_client__do_external_status(apr_hash_t *externals_new,
- svn_wc_status_func4_t status_func,
- void *status_baton,
+svn_client__do_external_status(svn_client_ctx_t *ctx,
+ apr_hash_t *externals_new,
svn_depth_t depth,
svn_boolean_t get_all,
svn_boolean_t update,
svn_boolean_t no_ignore,
- svn_client_ctx_t *ctx,
+ svn_client_status_func_t status_func,
+ void *status_baton,
apr_pool_t *pool)
{
apr_hash_index_t *hi;
@@ -1364,11 +1364,12 @@ svn_client__do_external_status(apr_hash_
iterpool), iterpool);
/* And then do the status. */
- SVN_ERR(svn_client_status5(NULL, fullpath,
+ SVN_ERR(svn_client_status5(NULL, ctx, fullpath,
&(external->revision),
- status_func, status_baton,
depth, get_all, update,
- no_ignore, FALSE, NULL, ctx, iterpool));
+ no_ignore, FALSE, NULL,
+ status_func, status_baton,
+ iterpool));
}
}
Modified: subversion/trunk/subversion/libsvn_client/status.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/status.c?rev=955542&r1=955541&r2=955542&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/status.c (original)
+++ subversion/trunk/subversion/libsvn_client/status.c Thu Jun 17 10:40:30 2010
@@ -50,15 +50,23 @@
accordingly. */
struct status_baton
{
- svn_boolean_t deleted_in_repos; /* target is deleted in repos */
- apr_hash_t *changelist_hash; /* keys are changelist names */
- svn_wc_status_func4_t real_status_func; /* real status function */
- void *real_status_baton; /* real status baton */
- const char *anchor_abspath; /* Absolute path of anchor */
- const char *anchor_relpath; /* Relative path of anchor */
- svn_wc_context_t *wc_ctx; /* A working copy context. */
+ svn_boolean_t deleted_in_repos; /* target is deleted in repos */
+ apr_hash_t *changelist_hash; /* keys are changelist names */
+ svn_client_status_func_t real_status_func; /* real status function */
+ void *real_status_baton; /* real status baton */
+ const char *anchor_abspath; /* Absolute path of anchor */
+ const char *anchor_relpath; /* Relative path of anchor */
+ svn_wc_context_t *wc_ctx; /* A working copy context. */
};
+/* Create svn_client_status_t from svn_wc_satus3_t */
+static svn_error_t *
+create_client_status(svn_client_status_t **cst,
+ const char *local_abspath,
+ const svn_wc_status3_t *status,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
/* A status callback function which wraps the *real* status
function/baton. This sucker takes care of any status tweaks we
need to make (such as noting that the target of the status is
@@ -73,6 +81,7 @@ tweak_status(void *baton,
{
struct status_baton *sb = baton;
const char *path = local_abspath;
+ svn_client_status_t *cst;
/* If we know that the target was deleted in HEAD of the repository,
we need to note that fact in all the status structures that come
@@ -96,8 +105,11 @@ tweak_status(void *baton,
sb->changelist_hash, scratch_pool))
return SVN_NO_ERROR;
+ SVN_ERR(create_client_status(&cst, local_abspath, status,
+ scratch_pool, scratch_pool));
+
/* Call the real status function/baton. */
- return sb->real_status_func(sb->real_status_baton, path, status,
+ return sb->real_status_func(sb->real_status_baton, path, cst,
scratch_pool);
}
@@ -228,17 +240,17 @@ static svn_ra_reporter3_t lock_fetch_rep
svn_error_t *
svn_client_status5(svn_revnum_t *result_rev,
+ svn_client_ctx_t *ctx,
const char *path,
const svn_opt_revision_t *revision,
- svn_wc_status_func4_t status_func,
- void *status_baton,
svn_depth_t depth,
svn_boolean_t get_all,
svn_boolean_t update,
svn_boolean_t no_ignore,
svn_boolean_t ignore_externals,
const apr_array_header_t *changelists,
- svn_client_ctx_t *ctx,
+ svn_client_status_func_t status_func,
+ void *status_baton,
apr_pool_t *pool) /* ### aka scratch_pool */
{
struct status_baton sb;
@@ -516,10 +528,128 @@ svn_client_status5(svn_revnum_t *result_
in the future.
*/
if (SVN_DEPTH_IS_RECURSIVE(depth) && (! ignore_externals))
- SVN_ERR(svn_client__do_external_status(externals_store.externals_new,
- status_func, status_baton,
+ SVN_ERR(svn_client__do_external_status(ctx, externals_store.externals_new,
depth, get_all,
- update, no_ignore, ctx, pool));
+ update, no_ignore,
+ status_func, status_baton, pool));
+
+ return SVN_NO_ERROR;
+}
+
+svn_client_status_t *
+svn_client_status_dup(const svn_client_status_t *status,
+ apr_pool_t *result_pool)
+{
+ svn_client_status_t *st = apr_palloc(result_pool, sizeof(*st));
+
+ *st = *status;
+
+ if (status->local_abspath)
+ st->local_abspath = apr_pstrdup(result_pool, status->local_abspath);
+
+ if (status->repos_root_url)
+ st->repos_root_url = apr_pstrdup(result_pool, status->repos_root_url);
+
+ if (status->repos_relpath)
+ st->repos_relpath = apr_pstrdup(result_pool, status->repos_relpath);
+
+ if (status->changed_author)
+ st->changed_author = apr_pstrdup(result_pool, status->changed_author);
+
+ if (status->lock)
+ st->lock = svn_lock_dup(status->lock, result_pool);
+
+ if (status->changelist)
+ st->changelist = apr_pstrdup(result_pool, status->changelist);
+
+ if (status->repos_lock)
+ st->repos_lock = svn_lock_dup(status->repos_lock, result_pool);
+
+ if (status->backwards_compatibility_baton)
+ {
+ const svn_wc_status3_t *wc_st = status->backwards_compatibility_baton;
+
+ st->backwards_compatibility_baton = svn_wc_dup_status3(wc_st,
+ result_pool);
+ }
+
+ return st;
+}
+
+/* Create a svn_client_status_t structure *CST for LOCAL_ABSPATH, shallow
+ * copying data from *STATUS wherever possible and retrieving the other values
+ * where needed. Peform temporary allocations in SCRATCH_POOL and allocate the
+ * result in RESULT_POOL
+ */
+static svn_error_t *
+create_client_status(svn_client_status_t **cst,
+ const char *local_abspath,
+ const svn_wc_status3_t *status,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ *cst = apr_pcalloc(result_pool, sizeof(**cst));
+
+ (*cst)->kind = status->kind;
+ (*cst)->local_abspath = local_abspath;
+ (*cst)->versioned = status->versioned;
+
+ (*cst)->conflicted = status->conflicted;
+
+ /* ### libsvn_wc doesn't have node status yet */
+ (*cst)->node_status = status->text_status;
+ (*cst)->text_status = status->text_status;
+ (*cst)->prop_status = status->prop_status;
+
+ (*cst)->switched = status->switched;
+
+ (*cst)->locked = status->locked;
+ (*cst)->copied = status->copied;
+ (*cst)->revision = status->revision;
+
+ (*cst)->changed_rev = status->changed_rev;
+ (*cst)->changed_date = status->changed_date;
+ (*cst)->changed_author = status->changed_author;
+
+ (*cst)->repos_root_url = status->repos_root_url;
+ (*cst)->repos_relpath = status->repos_relpath;
+
+ (*cst)->switched = status->switched;
+ (*cst)->file_external = status->file_external;
+
+ if (status->lock_token)
+ {
+ svn_lock_t *lock = apr_pcalloc(result_pool, sizeof(*lock));
+
+ lock->path = status->repos_relpath;
+ lock->token = status->lock_token;
+ lock->owner = status->lock_owner;
+ lock->comment = status->lock_comment;
+ lock->creation_date = status->lock_creation_date;
+
+ (*cst)->lock = lock;
+ }
+ else
+ (*cst)->lock = NULL;
+
+ (*cst)->changelist = status->changelist;
+ (*cst)->depth = status->depth;
+
+ /* Out of date information */
+ (*cst)->ood_kind = status->ood_kind;
+ (*cst)->repos_node_status = status->repos_text_status;
+ (*cst)->repos_text_status = status->repos_text_status;
+ (*cst)->repos_prop_status = status->repos_prop_status;
+ (*cst)->repos_lock = status->repos_lock;
+
+ (*cst)->ood_changed_rev = status->ood_last_cmt_rev;
+ (*cst)->ood_changed_date = status->ood_last_cmt_date;
+ (*cst)->ood_changed_author = status->ood_last_cmt_author;
+
+ /* When changing the value of backwards_compatibility_baton, also
+ change its use in status4_wrapper_func in deprecated.c */
+ (*cst)->backwards_compatibility_baton = status;
return SVN_NO_ERROR;
}
+
Modified: subversion/trunk/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cl.h?rev=955542&r1=955541&r2=955542&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/cl.h (original)
+++ subversion/trunk/subversion/svn/cl.h Thu Jun 17 10:40:30 2010
@@ -390,7 +390,7 @@ svn_cl__time_cstring_to_human_cstring(co
*/
svn_error_t *
svn_cl__print_status(const char *path,
- const svn_wc_status3_t *status,
+ const svn_client_status_t *status,
svn_boolean_t detailed,
svn_boolean_t show_last_committed,
svn_boolean_t skip_unrecognized,
@@ -406,7 +406,7 @@ svn_cl__print_status(const char *path,
allocations. */
svn_error_t *
svn_cl__print_status_xml(const char *path,
- const svn_wc_status3_t *status,
+ const svn_client_status_t *status,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
Modified: subversion/trunk/subversion/svn/status-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/status-cmd.c?rev=955542&r1=955541&r2=955542&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/status-cmd.c (original)
+++ subversion/trunk/subversion/svn/status-cmd.c Thu Jun 17 10:40:30 2010
@@ -74,7 +74,7 @@ struct status_baton
struct status_cache
{
const char *path;
- svn_wc_status3_t *status;
+ svn_client_status_t *status;
};
/* Print conflict stats accumulated in status baton SB.
@@ -143,7 +143,7 @@ print_finish_target_xml(svn_revnum_t rep
static svn_error_t *
print_status_normal_or_xml(void *baton,
const char *path,
- const svn_wc_status3_t *status,
+ const svn_client_status_t *status,
apr_pool_t *pool)
{
struct status_baton *sb = baton;
@@ -167,19 +167,19 @@ print_status_normal_or_xml(void *baton,
static svn_error_t *
print_status(void *baton,
const char *path,
- const svn_wc_status3_t *status,
+ const svn_client_status_t *status,
apr_pool_t *pool)
{
struct status_baton *sb = baton;
- svn_wc_status3_t *tweaked_status;
+ svn_client_status_t *tweaked_status;
svn_revnum_t revision;
svn_revnum_t changed_rev;
apr_time_t changed_date;
const char *changed_author;
const char *local_abspath;
- SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, sb->cl_pool));
- tweaked_status = svn_wc_dup_status3(status, sb->cl_pool);
+ local_abspath = status->local_abspath;
+ tweaked_status = svn_client_status_dup(status, sb->cl_pool);
/* ### The revision information with associates are based on what
* ### _read_info() returns. The svn_wc_status_func4_t callback is
@@ -211,7 +211,7 @@ print_status(void *baton,
const char *cl_key = apr_pstrdup(sb->cl_pool, status->changelist);
struct status_cache *scache = apr_pcalloc(sb->cl_pool, sizeof(*scache));
scache->path = apr_pstrdup(sb->cl_pool, path);
- scache->status = svn_wc_dup_status3(tweaked_status, sb->cl_pool);
+ scache->status = svn_client_status_dup(tweaked_status, sb->cl_pool);
path_array =
apr_hash_get(sb->cached_changelists, cl_key, APR_HASH_KEY_STRING);
@@ -308,15 +308,15 @@ svn_cl__status(apr_getopt_t *os,
/* Retrieve a hash of status structures with the information
requested by the user. */
- SVN_ERR(svn_cl__try(svn_client_status5(&repos_rev, target, &rev,
- print_status, &sb,
+ SVN_ERR(svn_cl__try(svn_client_status5(&repos_rev, ctx, target, &rev,
opt_state->depth,
opt_state->verbose,
opt_state->update,
opt_state->no_ignore,
opt_state->ignore_externals,
opt_state->changelists,
- ctx, iterpool),
+ print_status, &sb,
+ iterpool),
NULL, opt_state->quiet,
/* not versioned: */
SVN_ERR_WC_NOT_WORKING_COPY,
Modified: subversion/trunk/subversion/svn/status.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/status.c?rev=955542&r1=955541&r2=955542&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/status.c (original)
+++ subversion/trunk/subversion/svn/status.c Thu Jun 17 10:40:30 2010
@@ -63,7 +63,7 @@ generate_status_code(enum svn_wc_status_
/* Return the single character representation of the switched column
status. */
static char
-generate_switch_column_code(const svn_wc_status3_t *status)
+generate_switch_column_code(const svn_client_status_t *status)
{
if (status->switched)
return 'S';
@@ -105,7 +105,7 @@ print_status(const char *path,
svn_boolean_t detailed,
svn_boolean_t show_last_committed,
svn_boolean_t repos_locks,
- const svn_wc_status3_t *status,
+ const svn_client_status_t *status,
unsigned int *text_conflicts,
unsigned int *prop_conflicts,
unsigned int *tree_conflicts,
@@ -193,9 +193,9 @@ print_status(const char *path,
{
if (status->repos_lock)
{
- if (status->lock_token)
+ if (status->lock)
{
- if (strcmp(status->repos_lock->token, status->lock_token)
+ if (strcmp(status->repos_lock->token, status->lock->token)
== 0)
lock_status = 'K';
else
@@ -204,13 +204,13 @@ print_status(const char *path,
else
lock_status = 'O';
}
- else if (status->lock_token)
+ else if (status->lock)
lock_status = 'B';
else
lock_status = ' ';
}
else
- lock_status = (status->lock_token) ? 'K' : ' ';
+ lock_status = (status->lock) ? 'K' : ' ';
if (show_last_committed)
{
@@ -271,7 +271,7 @@ print_status(const char *path,
status->locked ? 'L' : ' ',
status->copied ? '+' : ' ',
generate_switch_column_code(status),
- ((status->lock_token)
+ ((status->lock)
? 'K' : ' '),
tree_status_code,
path,
@@ -283,7 +283,7 @@ print_status(const char *path,
svn_error_t *
svn_cl__print_status_xml(const char *path,
- const svn_wc_status3_t *status,
+ const svn_client_status_t *status,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
@@ -335,27 +335,27 @@ svn_cl__print_status_xml(const char *pat
pool);
}
- if (status->lock_token)
+ if (status->lock)
{
svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "lock", NULL);
- svn_cl__xml_tagged_cdata(&sb, pool, "token", status->lock_token);
+ svn_cl__xml_tagged_cdata(&sb, pool, "token", status->lock->token);
/* If lock_owner is NULL, assume WC is corrupt. */
- if (status->lock_owner)
+ if (status->lock->owner)
svn_cl__xml_tagged_cdata(&sb, pool, "owner",
- status->lock_owner);
+ status->lock->owner);
else
return svn_error_createf(SVN_ERR_WC_CORRUPT, NULL,
_("'%s' has lock token, but no lock owner"),
svn_dirent_local_style(path, pool));
svn_cl__xml_tagged_cdata(&sb, pool, "comment",
- status->lock_comment);
+ status->lock->comment);
svn_cl__xml_tagged_cdata(&sb, pool, "created",
svn_time_to_cstring
- (status->lock_creation_date, pool));
+ (status->lock->creation_date, pool));
svn_xml_make_close_tag(&sb, pool, "lock");
}
@@ -411,7 +411,7 @@ svn_cl__print_status_xml(const char *pat
/* Called by status-cmd.c */
svn_error_t *
svn_cl__print_status(const char *path,
- const svn_wc_status3_t *status,
+ const svn_client_status_t *status,
svn_boolean_t detailed,
svn_boolean_t show_last_committed,
svn_boolean_t skip_unrecognized,
@@ -422,10 +422,9 @@ svn_cl__print_status(const char *path,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
- const char *local_abspath;
+ const char *local_abspath = status->local_abspath;
svn_boolean_t tree_conflicted;
- SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
SVN_ERR(svn_wc__node_check_conflicts(NULL, NULL, &tree_conflicted,
ctx->wc_ctx, local_abspath, pool,
pool));
Re: svn commit: r955542 - in /subversion/trunk/subversion:
bindings/javahl/native/ include/ libsvn_client/ svn/
Posted by Julian Foad <ju...@wandisco.com>.
On Thu, 2010-06-17, rhuijben@apache.org wrote:
> Author: rhuijben
> Date: Thu Jun 17 10:40:30 2010
> New Revision: 955542
>
> URL: http://svn.apache.org/viewvc?rev=955542&view=rev
> Log:
> Introduce a new svn_client_status_t structure to separate the public
> client status api from the implementation of status in libsvn_wc, to
> allow further cleanup in libsvn_wc. Note that this libsvn_client
> function still uses relative paths in its api to avoid breaking
> third party code even more than necessary for removing entries.
[...]
Hi Bert. Very good work!
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=955542&r1=955541&r2=955542&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/include/svn_client.h (original)
> +++ subversion/trunk/subversion/include/svn_client.h Thu Jun 17 10:40:30 2010
> @@ -1843,6 +1843,183 @@ svn_client_commit(svn_client_commit_info
> */
>
> /**
> + * Structure for holding the "status" of a working copy item.
> + *
> + * The item's entry data is in @a entry, augmented and possibly shadowed
> + * by the other fields. @a entry is @c NULL if this item is not under
> + * version control.
That paragraph appears to be obsolete.
> + * @note Fields may be added to the end of this structure in future
> + * versions. Therefore, to preserve binary compatibility, users
> + * should not directly allocate structures of this type.
> + *
> + * @since New in 1.7.
> + */
> +typedef struct svn_client_status_t
> +{
[...]
- Julian