You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2010/04/30 17:04:13 UTC
svn commit: r939701 - in /subversion/trunk/subversion:
include/private/svn_wc_private.h libsvn_client/commit_util.c
libsvn_client/info.c libsvn_client/locking_commands.c libsvn_wc/node.c
Author: cmpilato
Date: Fri Apr 30 15:04:12 2010
New Revision: 939701
URL: http://svn.apache.org/viewvc?rev=939701&view=rev
Log:
Expand the scope of a lock-related WC-NG node API to increase its
utility, and then use it some more.
* subversion/include/private/svn_wc_private.h,
* subversion/libsvn_wc/node.c
(svn_wc__node_get_lock_info): Was svn_wc__node_get_lock_token().
Add 'lock_owner', 'lock_comment, and 'lock_date' field. Make
all return fields optional.
* subversion/libsvn_client/commit_util.c
(add_lock_token, harvest_committables): Track renamed/modified function.
* subversion/libsvn_client/locking_commands.c
(organize_lock_targets): Track renamed/modified function.
* subversion/libsvn_client/info.c
(build_info_for_entry): Use svn_wc__node_get_lock_token() to fetch
lock information instead of culling it out of an svn_wc_entry_t.
Modified:
subversion/trunk/subversion/include/private/svn_wc_private.h
subversion/trunk/subversion/libsvn_client/commit_util.c
subversion/trunk/subversion/libsvn_client/info.c
subversion/trunk/subversion/libsvn_client/locking_commands.c
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=939701&r1=939700&r2=939701&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Fri Apr 30 15:04:12 2010
@@ -550,16 +550,28 @@ svn_wc__node_get_commit_base_rev(svn_rev
apr_pool_t *scratch_pool);
/**
- * Get the lock token of @a local_abspath using @a wc_ctx or NULL
- * if there is no lock. If @a local_abspath is not in the working
-* copy, return @c SVN_ERR_WC_PATH_NOT_FOUND.
+ * Fetch lock information (if any) for @a local_abspath using @a wc_ctx:
+ *
+ * Set @a *lock_token to the lock token (or NULL)
+ * Set @a *lock_owner to the owner of the lock (or NULL)
+ * Set @a *lock_comment to the comment associated with the lock (or NULL)
+ * Set @a *lock_date to the timestamp of the lock (or 0)
+ *
+ * Any of the aforementioned return values may be NULL to indicate
+ * that the caller doesn't care about those values.
+ *
+ * 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_lock_token(const char **lock_token,
- svn_wc_context_t *wc_ctx,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
+svn_wc__node_get_lock_info(const char **lock_token,
+ const char **lock_owner,
+ const char **lock_comment,
+ apr_time_t *lock_date,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/* Return TRUE in *FILE_EXTERNAL if the node LOCAL_ABSPATH is a file
Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=939701&r1=939700&r2=939701&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Fri Apr 30 15:04:12 2010
@@ -203,8 +203,9 @@ add_lock_token(const char *local_abspath
/* I want every lock-token I can get my dirty hands on!
If this entry is switched, so what. We will send an irrelevant lock
token. */
- SVN_ERR(svn_wc__node_get_lock_token(&lock_token, altb->wc_ctx, local_abspath,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_wc__node_get_lock_info(&lock_token, NULL, NULL, NULL,
+ altb->wc_ctx, local_abspath,
+ scratch_pool, scratch_pool));
if (!lock_token)
return SVN_NO_ERROR;
@@ -651,10 +652,10 @@ harvest_committables(apr_hash_t *committ
such, note this fact. */
if (lock_tokens && (state_flags || just_locked))
{
- SVN_ERR(svn_wc__node_get_lock_token(&entry_lock_token,
- ctx->wc_ctx, local_abspath,
- apr_hash_pool_get(lock_tokens),
- scratch_pool));
+ SVN_ERR(svn_wc__node_get_lock_info(&entry_lock_token, NULL, NULL, NULL,
+ ctx->wc_ctx, local_abspath,
+ apr_hash_pool_get(lock_tokens),
+ scratch_pool));
if (entry_lock_token)
state_flags |= SVN_CLIENT_COMMIT_ITEM_LOCK_TOKEN;
}
Modified: subversion/trunk/subversion/libsvn_client/info.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/info.c?rev=939701&r1=939700&r2=939701&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/info.c (original)
+++ subversion/trunk/subversion/libsvn_client/info.c Fri Apr 30 15:04:12 2010
@@ -92,6 +92,8 @@ build_info_for_entry(svn_info_t **info,
svn_revnum_t copyfrom_rev;
svn_boolean_t is_copy_target;
const svn_wc_entry_t *entry;
+ const char *lock_token, *lock_owner, *lock_comment;
+ apr_time_t lock_date;
SVN_ERR(svn_wc__get_entry_versioned(&entry, wc_ctx, local_abspath,
svn_node_unknown, TRUE, FALSE,
@@ -159,14 +161,16 @@ build_info_for_entry(svn_info_t **info,
tmpinfo->working_size64 = entry->working_size;
/* lock stuff */
- if (entry->lock_token) /* the token is the critical bit. */
+ SVN_ERR(svn_wc__node_get_lock_info(&lock_token, &lock_owner,
+ &lock_comment, &lock_date,
+ wc_ctx, local_abspath, pool, pool));
+ if (lock_token) /* the token is the critical bit. */
{
tmpinfo->lock = apr_pcalloc(pool, sizeof(*(tmpinfo->lock)));
-
- tmpinfo->lock->token = entry->lock_token;
- tmpinfo->lock->owner = entry->lock_owner;
- tmpinfo->lock->comment = entry->lock_comment;
- tmpinfo->lock->creation_date = entry->lock_creation_date;
+ tmpinfo->lock->token = lock_token;
+ tmpinfo->lock->owner = lock_owner;
+ tmpinfo->lock->comment = lock_comment;
+ tmpinfo->lock->creation_date = lock_date;
}
*info = tmpinfo;
Modified: subversion/trunk/subversion/libsvn_client/locking_commands.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/locking_commands.c?rev=939701&r1=939700&r2=939701&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/locking_commands.c (original)
+++ subversion/trunk/subversion/libsvn_client/locking_commands.c Fri Apr 30 15:04:12 2010
@@ -320,10 +320,9 @@ organize_lock_targets(const char **commo
{
const char *lock_token;
- SVN_ERR(svn_wc__node_get_lock_token(&lock_token,
- ctx->wc_ctx,
- abs_path,
- pool, subpool));
+ SVN_ERR(svn_wc__node_get_lock_info(&lock_token, NULL, NULL,
+ NULL, ctx->wc_ctx,
+ abs_path, pool, subpool));
if (! lock_token)
return svn_error_createf
(SVN_ERR_CLIENT_MISSING_LOCK_TOKEN, NULL,
Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=939701&r1=939700&r2=939701&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Fri Apr 30 15:04:12 2010
@@ -930,11 +930,14 @@ svn_wc__node_get_commit_base_rev(svn_rev
}
svn_error_t *
-svn_wc__node_get_lock_token(const char **lock_token,
- svn_wc_context_t *wc_ctx,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
+svn_wc__node_get_lock_info(const char **lock_token,
+ const char **lock_owner,
+ const char **lock_comment,
+ apr_time_t *lock_date,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
svn_wc__db_lock_t *lock;
@@ -945,8 +948,15 @@ svn_wc__node_get_lock_token(const char *
NULL, &lock,
wc_ctx->db, local_abspath,
result_pool, scratch_pool));
- *lock_token = lock ? lock->token : NULL;
-
+ if (lock_token)
+ *lock_token = lock ? lock->token : NULL;
+ if (lock_owner)
+ *lock_owner = lock ? lock->owner : NULL;
+ if (lock_comment)
+ *lock_comment = lock ? lock->comment : NULL;
+ if (lock_date)
+ *lock_date = lock ? lock->date : 0;
+
return SVN_NO_ERROR;
}