You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2010/08/07 16:55:24 UTC
svn commit: r983237 - in /subversion/branches/atomic-revprop: BRANCH-README
subversion/include/svn_client.h subversion/libsvn_client/prop_commands.c
Author: danielsh
Date: Sat Aug 7 14:55:24 2010
New Revision: 983237
URL: http://svn.apache.org/viewvc?rev=983237&view=rev
Log:
On the 'atomic-revprop' branch:
Upgrade svn_client_revprop_set2() to be atomic, when possible.
* subversion/include/svn_client.h
(svn_client_revprop_set2):
Update doc string.
* subversion/libsvn_client/prop_commands.c
(check_and_set_revprop):
Call svn_ra_change_rev_prop2() instead of svn_ra_change_rev_prop().
(svn_client_revprop_set2):
Take advantage of SVN_RA_CAPABILITY_ATOMIC_REVPROPS if advertised.
* BRANCH-README:
Mark this as done.
Modified:
subversion/branches/atomic-revprop/BRANCH-README
subversion/branches/atomic-revprop/subversion/include/svn_client.h
subversion/branches/atomic-revprop/subversion/libsvn_client/prop_commands.c
Modified: subversion/branches/atomic-revprop/BRANCH-README
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/BRANCH-README?rev=983237&r1=983236&r2=983237&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/BRANCH-README (original)
+++ subversion/branches/atomic-revprop/BRANCH-README Sat Aug 7 14:55:24 2010
@@ -30,7 +30,7 @@ Planned work
prop_tests.py 34: atomic_over_ra()
TODO: extend it to test props set to the empty string
-* client support: svn_client_revprop_set2()
+* [DONE] client support: svn_client_revprop_set2()
* svnsync:
- use the new RA API to resolve the race condition in locking.
Modified: subversion/branches/atomic-revprop/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/include/svn_client.h?rev=983237&r1=983236&r2=983237&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/include/svn_client.h (original)
+++ subversion/branches/atomic-revprop/subversion/include/svn_client.h Sat Aug 7 14:55:24 2010
@@ -4089,6 +4089,12 @@ svn_client_propset(const char *propname,
* new value. (To check that an old value is still non-existent, set
* @a original_propval->data to NULL, and @a original_propval->len is
* ignored.)
+ * If the server advertises #SVN_RA_CAPABILITY_ATOMIC_REVPROPS, the
+ * check of @a original_propval is done atomically.
+ *
+ * Note: the representation of "property is not set" in @a
+ * original_propval differs from the representation in other APIs
+ * (such as svn_fs_change_rev_prop2() and svn_ra_change_rev_prop2()).
*
* If @a force is TRUE, allow newlines in the author property.
*
Modified: subversion/branches/atomic-revprop/subversion/libsvn_client/prop_commands.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_client/prop_commands.c?rev=983237&r1=983236&r2=983237&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_client/prop_commands.c Sat Aug 7 14:55:24 2010
@@ -487,8 +487,8 @@ check_and_set_revprop(svn_revnum_t *set_
}
/* The actual RA call. */
- SVN_ERR(svn_ra_change_rev_prop(ra_session, *set_rev, propname,
- propval, pool));
+ SVN_ERR(svn_ra_change_rev_prop2(ra_session, *set_rev, propname,
+ NULL, propval, pool));
return SVN_NO_ERROR;
}
@@ -505,6 +505,7 @@ svn_client_revprop_set2(const char *prop
apr_pool_t *pool)
{
svn_ra_session_t *ra_session;
+ svn_boolean_t be_atomic;
if ((strcmp(propname, SVN_PROP_REVISION_AUTHOR) == 0)
&& propval
@@ -528,8 +529,29 @@ svn_client_revprop_set2(const char *prop
SVN_ERR(svn_client__get_revision_number(set_rev, NULL, ctx->wc_ctx, NULL,
ra_session, revision, pool));
- SVN_ERR(check_and_set_revprop(set_rev, ra_session, propname,
- original_propval, propval, pool));
+ SVN_ERR(svn_ra_has_capability(ra_session, &be_atomic,
+ SVN_RA_CAPABILITY_ATOMIC_REVPROPS, pool));
+ if (be_atomic)
+ {
+ /* Convert ORIGINAL_PROPVAL to an OLD_VALUE_P. */
+ const svn_string_t *const *old_value_p;
+ const svn_string_t *unset = NULL;
+
+ if (original_propval == NULL)
+ old_value_p = NULL;
+ else if (original_propval->data == NULL)
+ old_value_p = &unset;
+ else
+ old_value_p = &original_propval;
+
+ SVN_ERR(svn_ra_change_rev_prop2(ra_session, *set_rev, propname,
+ old_value_p, propval, pool));
+ }
+ else
+ {
+ SVN_ERR(check_and_set_revprop(set_rev, ra_session, propname,
+ original_propval, propval, pool));
+ }
if (ctx->notify_func2)
{