Author: danielsh
Date: Sat Jul 24 10:39:26 2010
New Revision: 978843
URL: http://svn.apache.org/viewvc?rev=978843&view=rev
Log:
On the 'atomic-revprop' branch
Add a skeleton RA interface, but do not implement it yet. (This revision
only does the "Revv the vtable member" dance.)
First, add the API proper:
* subversion/include/svn_ra.h
(svn_ra_change_rev_prop2): New API.
(SVN_RA_CAPABILITY_ATOMIC_REVPROPS): New RA capability.
(svn_ra_change_rev_prop): Deprecate.
* subversion/libsvn_ra/ra_loader.c
(svn_ra_change_rev_prop): Rename to...
(svn_ra_change_rev_prop2): ...this, adding and using an OLD_VALUE_P parameter.
* subversion/libsvn_ra/deprecated.c
(svn_ra_change_rev_prop): New, wraps svn_ra_change_rev_prop2().
* subversion/libsvn_ra/ra_loader.h
(svn_ra__vtable_t.change_rev_prop): Add OLD_VALUE_P parameter.
* subversion/libsvn_ra/wrapper_template.h
(compat_change_rev_prop): Update call to vtable->change_rev_prop().
Then, add the first call to the new API:
* subversion/tests/cmdline/atomic-ra-revprop-change.c
(change_rev_prop):
Call svn_ra_change_rev_prop2() with OLD_VALUE, instead
of calling svn_ra_change_rev_prop() and ignoring OLD_VALUE.
Finally, add skeleton implementations in the RA providers:
* subversion/libsvn_ra_local/ra_plugin.c
(svn_ra_local__change_rev_prop),
* subversion/libsvn_ra_svn/client.c
(ra_svn_change_rev_prop),
* subversion/libsvn_ra_serf/ra_serf.h
(svn_ra_serf__change_rev_prop),
* subversion/libsvn_ra_serf/commit.c
(svn_ra_serf__change_rev_prop),
* subversion/libsvn_ra_neon/ra_neon.h
(svn_ra_neon__change_rev_prop),
* subversion/libsvn_ra_neon/fetch.c
(svn_ra_neon__change_rev_prop):
Add an OLD_VALUE_P parameter, and raise a malfunction if it's passed as
non-NULL.
Modified:
subversion/branches/atomic-revprop/subversion/include/svn_ra.h
subversion/branches/atomic-revprop/subversion/libsvn_ra/deprecated.c
subversion/branches/atomic-revprop/subversion/libsvn_ra/ra_loader.c
subversion/branches/atomic-revprop/subversion/libsvn_ra/ra_loader.h
subversion/branches/atomic-revprop/subversion/libsvn_ra/wrapper_template.h
subversion/branches/atomic-revprop/subversion/libsvn_ra_local/ra_plugin.c
subversion/branches/atomic-revprop/subversion/libsvn_ra_neon/fetch.c
subversion/branches/atomic-revprop/subversion/libsvn_ra_neon/ra_neon.h
subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/commit.c
subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/ra_serf.h
subversion/branches/atomic-revprop/subversion/libsvn_ra_svn/client.c
subversion/branches/atomic-revprop/subversion/tests/cmdline/atomic-ra-revprop-change.c
Modified: subversion/branches/atomic-revprop/subversion/include/svn_ra.h
URL:
http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/include/svn_ra.h?rev=978843&r1=978842&r2=978843&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/include/svn_ra.h (original)
+++ subversion/branches/atomic-revprop/subversion/include/svn_ra.h Sat Jul 24
10:39:26 2010
@@ -718,12 +718,35 @@ svn_ra_get_dated_revision(svn_ra_session
*
* If @a value is @c NULL, delete the named revision property.
*
+ * If the server advertises the #SVN_RA_CAPABILITY_ATOMIC_REVPROPS capability
+ * and @a old_value_p is not @c NULL, then the property will be changed
+ * iff its current value is @a *old_value_p. (Note that @a *old_value_p
+ * may be @c NULL, representing that the property must be currently unset.)
+ *
+ * If the capability is not advertised, then @a old_value_p MUST be @c NULL.
+ *
* Please note that properties attached to revisions are @em unversioned.
*
* Use @a pool for memory allocation.
*
+ * @since New in 1.7.
+ */
+svn_error_t *
+svn_ra_change_rev_prop2(svn_ra_session_t *session,
+ svn_revnum_t rev,
+ const char *name,
+ const svn_string_t *const *old_value_p,
+ const svn_string_t *value,
+ apr_pool_t *pool);
+
+/**
+ * Similar to svn_ra_change_rev_prop2(), but with @a old_value_p set
+ * to @c NULL.
+ *
* @since New in 1.2.
+ * @deprecated Provided for backward compatibility with the 1.6 API.
*/
+SVN_DEPRECATED
svn_error_t *
svn_ra_change_rev_prop(svn_ra_session_t *session,
svn_revnum_t rev,
@@ -1884,6 +1907,14 @@ svn_ra_has_capability(svn_ra_session_t *
*/
#define SVN_RA_CAPABILITY_COMMIT_REVPROPS "commit-revprops"
+/**
+ * The capability of specifying (and atomically verifying) expected
+ * preexisting values when modifying revprops.
+ *
+ * @since New in 1.7.
+ */
+#define SVN_RA_CAPABILITY_ATOMIC_REVPROPS "atomic-revprops"
+
/* *** PLEASE READ THIS IF YOU ADD A NEW CAPABILITY ***
*
* RA layers generally fetch all capabilities when asked about any
Modified: subversion/branches/atomic-revprop/subversion/libsvn_ra/deprecated.c
URL:
http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra/deprecated.c?rev=978843&r1=978842&r2=978843&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra/deprecated.c
(original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra/deprecated.c Sat
Jul 24 10:39:26 2010
@@ -183,6 +183,15 @@ svn_error_t *svn_ra_open(svn_ra_session_
config, pool);
}
+svn_error_t *svn_ra_change_rev_prop(svn_ra_session_t *session,
+ svn_revnum_t rev,
+ const char *name,
+ const svn_string_t *value,
+ apr_pool_t *pool)
+{
+ return svn_ra_change_rev_prop2(session, rev, name, NULL, value, pool);
+}
+
svn_error_t *svn_ra_get_commit_editor2(svn_ra_session_t *session,
const svn_delta_editor_t **editor,
void **edit_baton,
Modified: subversion/branches/atomic-revprop/subversion/libsvn_ra/ra_loader.c
URL:
http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra/ra_loader.c?rev=978843&r1=978842&r2=978843&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra/ra_loader.c
(original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra/ra_loader.c Sat Jul
24 10:39:26 2010
@@ -594,14 +594,37 @@ svn_error_t *svn_ra_get_dated_revision(s
return session->vtable->get_dated_revision(session, revision, tm, pool);
}
-svn_error_t *svn_ra_change_rev_prop(svn_ra_session_t *session,
- svn_revnum_t rev,
- const char *name,
- const svn_string_t *value,
- apr_pool_t *pool)
+svn_error_t *svn_ra_change_rev_prop2(svn_ra_session_t *session,
+ svn_revnum_t rev,
+ const char *name,
+ const svn_string_t *const *old_value_p,
+ const svn_string_t *value,
+ apr_pool_t *pool)
{
SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(rev));
- return session->vtable->change_rev_prop(session, rev, name, value, pool);
+
+ /* If an old value was specified, make sure the server supports
+ * specifying it. */
+ if (old_value_p)
+ {
+ svn_boolean_t has_atomic_revprops;
+
+ SVN_ERR(svn_ra_has_capability(session, &has_atomic_revprops,
+ SVN_RA_CAPABILITY_ATOMIC_REVPROPS,
+ pool));
+
+ if (!has_atomic_revprops)
+ /* API violation. (Should be an ASSERT, but gstein talked me
+ * out of it.) */
+ return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+ _("Specifying 'old_value_p' is not allowed
when "
+ "the '%s' capability is not advertised, and
"
+ "could indicate a bug in your client"),
+ SVN_RA_CAPABILITY_ATOMIC_REVPROPS);
+ }
+
+ return session->vtable->change_rev_prop(session, rev, name,
+ old_value_p, value, pool);
}
svn_error_t *svn_ra_rev_proplist(svn_ra_session_t *session,
Modified: subversion/branches/atomic-revprop/subversion/libsvn_ra/ra_loader.h
URL:
http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra/ra_loader.h?rev=978843&r1=978842&r2=978843&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra/ra_loader.h
(original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra/ra_loader.h Sat Jul
24 10:39:26 2010
@@ -76,6 +76,7 @@ typedef struct svn_ra__vtable_t {
svn_error_t *(*change_rev_prop)(svn_ra_session_t *session,
svn_revnum_t rev,
const char *name,
+ const svn_string_t *const *old_value_p,
const svn_string_t *value,
apr_pool_t *pool);
Modified:
subversion/branches/atomic-revprop/subversion/libsvn_ra/wrapper_template.h
URL:
http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra/wrapper_template.h?rev=978843&r1=978842&r2=978843&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra/wrapper_template.h
(original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra/wrapper_template.h
Sat Jul 24 10:39:26 2010
@@ -114,7 +114,7 @@ static svn_error_t *compat_change_rev_pr
const svn_string_t *value,
apr_pool_t *pool)
{
- return VTBL.change_rev_prop(session_baton, rev, propname, value, pool);
+ return VTBL.change_rev_prop(session_baton, rev, propname, NULL, value, pool);
}
static svn_error_t *compat_rev_proplist(void *session_baton,
Modified:
subversion/branches/atomic-revprop/subversion/libsvn_ra_local/ra_plugin.c
URL:
http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra_local/ra_plugin.c?rev=978843&r1=978842&r2=978843&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra_local/ra_plugin.c
(original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra_local/ra_plugin.c
Sat Jul 24 10:39:26 2010
@@ -558,10 +558,15 @@ static svn_error_t *
svn_ra_local__change_rev_prop(svn_ra_session_t *session,
svn_revnum_t rev,
const char *name,
+ const svn_string_t *const *old_value_p,
const svn_string_t *value,
apr_pool_t *pool)
{
svn_ra_local__session_baton_t *sess = session->priv;
+
+ if (old_value_p)
+ SVN__NOT_IMPLEMENTED();
+
SVN_ERR(get_username(session, pool));
return svn_repos_fs_change_rev_prop3(sess->repos, rev, sess->username,
name, value, TRUE, TRUE, NULL, NULL,
Modified: subversion/branches/atomic-revprop/subversion/libsvn_ra_neon/fetch.c
URL:
http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra_neon/fetch.c?rev=978843&r1=978842&r2=978843&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra_neon/fetch.c
(original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra_neon/fetch.c Sat
Jul 24 10:39:26 2010
@@ -1122,6 +1122,7 @@ svn_error_t *svn_ra_neon__get_latest_rev
svn_error_t *svn_ra_neon__change_rev_prop(svn_ra_session_t *session,
svn_revnum_t rev,
const char *name,
+ const svn_string_t *const
*old_value_p,
const svn_string_t *value,
apr_pool_t *pool)
{
@@ -1136,6 +1137,9 @@ svn_error_t *svn_ra_neon__change_rev_pro
{ NULL }
};
+ if (old_value_p)
+ SVN__NOT_IMPLEMENTED();
+
/* Main objective: do a PROPPATCH (allprops) on a baseline object */
/* ### A Word From Our Sponsor: see issue #916.
Modified: subversion/branches/atomic-revprop/subversion/libsvn_ra_neon/ra_neon.h
URL:
http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra_neon/ra_neon.h?rev=978843&r1=978842&r2=978843&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra_neon/ra_neon.h
(original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra_neon/ra_neon.h Sat
Jul 24 10:39:26 2010
@@ -251,6 +251,7 @@ svn_error_t *svn_ra_neon__get_dated_revi
svn_error_t *svn_ra_neon__change_rev_prop(svn_ra_session_t *session,
svn_revnum_t rev,
const char *name,
+ const svn_string_t *const
*old_value_p,
const svn_string_t *value,
apr_pool_t *pool);
Modified: subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/commit.c
URL:
http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/commit.c?rev=978843&r1=978842&r2=978843&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/commit.c
(original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/commit.c Sat
Jul 24 10:39:26 2010
@@ -2146,6 +2146,7 @@ svn_error_t *
svn_ra_serf__change_rev_prop(svn_ra_session_t *ra_session,
svn_revnum_t rev,
const char *name,
+ const svn_string_t *const *old_value_p,
const svn_string_t *value,
apr_pool_t *pool)
{
@@ -2157,6 +2158,9 @@ svn_ra_serf__change_rev_prop(svn_ra_sess
apr_hash_t *props;
svn_error_t *err;
+ if (old_value_p)
+ SVN__NOT_IMPLEMENTED();
+
commit = apr_pcalloc(pool, sizeof(*commit));
commit->pool = pool;
Modified: subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/ra_serf.h
URL:
http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/ra_serf.h?rev=978843&r1=978842&r2=978843&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/ra_serf.h
(original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra_serf/ra_serf.h Sat
Jul 24 10:39:26 2010
@@ -1297,6 +1297,7 @@ svn_error_t *
svn_ra_serf__change_rev_prop(svn_ra_session_t *session,
svn_revnum_t rev,
const char *name,
+ const svn_string_t *const *old_value_p,
const svn_string_t *value,
apr_pool_t *pool);
Modified: subversion/branches/atomic-revprop/subversion/libsvn_ra_svn/client.c
URL:
http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_ra_svn/client.c?rev=978843&r1=978842&r2=978843&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_ra_svn/client.c
(original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_ra_svn/client.c Sat
Jul 24 10:39:26 2010
@@ -809,12 +809,16 @@ static svn_error_t *ra_svn_get_dated_rev
static svn_error_t *ra_svn_change_rev_prop(svn_ra_session_t *session,
svn_revnum_t rev,
const char *name,
+ const svn_string_t *const
*old_value_p,
const svn_string_t *value,
apr_pool_t *pool)
{
svn_ra_svn__session_baton_t *sess_baton = session->priv;
svn_ra_svn_conn_t *conn = sess_baton->conn;
+ if (old_value_p)
+ SVN__NOT_IMPLEMENTED();
+
SVN_ERR(svn_ra_svn_write_cmd(conn, pool, "change-rev-prop", "rc?s",
rev, name, value));
SVN_ERR(handle_auth_request(sess_baton, pool));
Modified:
subversion/branches/atomic-revprop/subversion/tests/cmdline/atomic-ra-revprop-change.c
URL:
http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/tests/cmdline/atomic-ra-revprop-change.c?rev=978843&r1=978842&r2=978843&view=diff
==============================================================================
---
subversion/branches/atomic-revprop/subversion/tests/cmdline/atomic-ra-revprop-change.c
(original)
+++
subversion/branches/atomic-revprop/subversion/tests/cmdline/atomic-ra-revprop-change.c
Sat Jul 24 10:39:26 2010
@@ -91,8 +91,8 @@ change_rev_prop(const char *url,
SVN_ERR(svn_ra_open3(&sess, url, NULL, callbacks, NULL /* baton */,
NULL /* config */, pool));
- /* XXX: pass OLD_PROPVAL here */
- SVN_ERR(svn_ra_change_rev_prop(sess, revision, propname, propval, pool));
+ SVN_ERR(svn_ra_change_rev_prop2(sess, revision, propname,
+ &old_value, propval, pool));
return SVN_NO_ERROR;
}