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/07/23 21:13:52 UTC

svn commit: r967212 - in /subversion/branches/atomic-revprop/subversion: include/svn_repos.h libsvn_repos/deprecated.c libsvn_repos/fs-wrap.c

Author: danielsh
Date: Fri Jul 23 19:13:52 2010
New Revision: 967212

URL: http://svn.apache.org/viewvc?rev=967212&view=rev
Log:
On the 'atomic-revprop' branch:

Implement atomic revprop changes support in libsvn_repos.

* subversion/include/svn_repos.h
  (svn_repos_fs_change_rev_prop4):  New.
  (svn_repos_fs_change_rev_prop3):  Deprecate.

* subversion/libsvn_repos/deprecated.c
  (svn_repos_fs_change_rev_prop3):
    Reimplement as wrapper around svn_repos_fs_change_rev_prop3().

* subversion/libsvn_repos/fs-wrap.c
  (svn_repos_fs_change_rev_prop3):  Rename to svn_repos_fs_change_rev_prop4().
  (svn_repos_fs_change_rev_prop4):
    Add OLD_VALUE_P parameter and, if supplied, pass it to the FS layer.

Modified:
    subversion/branches/atomic-revprop/subversion/include/svn_repos.h
    subversion/branches/atomic-revprop/subversion/libsvn_repos/deprecated.c
    subversion/branches/atomic-revprop/subversion/libsvn_repos/fs-wrap.c

Modified: subversion/branches/atomic-revprop/subversion/include/svn_repos.h
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/include/svn_repos.h?rev=967212&r1=967211&r2=967212&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/include/svn_repos.h (original)
+++ subversion/branches/atomic-revprop/subversion/include/svn_repos.h Fri Jul 23 19:13:52 2010
@@ -1994,28 +1994,55 @@ svn_repos_fs_get_locks(apr_hash_t **lock
 /** @} */
 
 /**
- * Like svn_fs_change_rev_prop(), but validate the name and value of the
+ * Like svn_fs_change_rev_prop2(), but validate the name and value of the
  * property and invoke the @a repos's pre- and post-revprop-change hooks
  * around the change as specified by @a use_pre_revprop_change_hook and
  * @a use_post_revprop_change_hook (respectively).
  *
  * @a rev is the revision whose property to change, @a name is the
  * name of the property, and @a new_value is the new value of the
- * property.   @a author is the authenticated username of the person
+ * property.   If @a old_value_p is not @c NULL, then @a *old_value_p
+ * is the expected current (preexisting) value of the property (or @c NULL
+ * for "unset").  @a author is the authenticated username of the person
  * changing the property value, or NULL if not available.
  *
  * If @a authz_read_func is non-NULL, then use it (with @a
  * authz_read_baton) to validate the changed-paths associated with @a
  * rev.  If the revision contains any unreadable changed paths, then
- * return SVN_ERR_AUTHZ_UNREADABLE.
+ * return #SVN_ERR_AUTHZ_UNREADABLE.
  *
  * Validate @a name and @a new_value like the same way
  * svn_repos_fs_change_node_prop() does.
  *
  * Use @a pool for temporary allocations.
  *
+ * @since New in 1.7.
+ */
+svn_error_t *
+svn_repos_fs_change_rev_prop4(svn_repos_t *repos,
+                              svn_revnum_t rev,
+                              const char *author,
+                              const char *name,
+                              const svn_string_t *const *old_value_p,
+                              const svn_string_t *new_value,
+                              svn_boolean_t
+                              use_pre_revprop_change_hook,
+                              svn_boolean_t
+                              use_post_revprop_change_hook,
+                              svn_repos_authz_func_t
+                              authz_read_func,
+                              void *authz_read_baton,
+                              apr_pool_t *pool);
+
+/**
+ * Similar to svn_repos_fs_change_rev_prop3(), but with @a old_value_p always
+ * set to @c NULL.  (In other words, it is similar to
+ * svn_fs_change_rev_prop().)
+ *
+ * @deprecated Provided for backward compatibility with the 1.6 API.
  * @since New in 1.5.
  */
+SVN_DEPRECATED
 svn_error_t *
 svn_repos_fs_change_rev_prop3(svn_repos_t *repos,
                               svn_revnum_t rev,

Modified: subversion/branches/atomic-revprop/subversion/libsvn_repos/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_repos/deprecated.c?rev=967212&r1=967211&r2=967212&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_repos/deprecated.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_repos/deprecated.c Fri Jul 23 19:13:52 2010
@@ -328,6 +328,26 @@ svn_repos_replay(svn_fs_root_t *root,
 
 /*** From fs-wrap.c ***/
 svn_error_t *
+svn_repos_fs_change_rev_prop3(svn_repos_t *repos,
+                              svn_revnum_t rev,
+                              const char *author,
+                              const char *name,
+                              const svn_string_t *new_value,
+                              svn_boolean_t use_pre_revprop_change_hook,
+                              svn_boolean_t use_post_revprop_change_hook,
+                              svn_repos_authz_func_t authz_read_func,
+                              void *authz_read_baton,
+                              apr_pool_t *pool)
+{
+  return svn_repos_fs_change_rev_prop4(repos, rev, author, name, NULL,
+                                       new_value,
+                                       use_pre_revprop_change_hook,
+                                       use_post_revprop_change_hook,
+                                       authz_read_func,
+                                       authz_read_baton, pool);
+}
+
+svn_error_t *
 svn_repos_fs_change_rev_prop2(svn_repos_t *repos,
                               svn_revnum_t rev,
                               const char *author,

Modified: subversion/branches/atomic-revprop/subversion/libsvn_repos/fs-wrap.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_repos/fs-wrap.c?rev=967212&r1=967211&r2=967212&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_repos/fs-wrap.c (original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_repos/fs-wrap.c Fri Jul 23 19:13:52 2010
@@ -263,10 +263,11 @@ svn_repos_fs_change_txn_prop(svn_fs_txn_
 
 
 svn_error_t *
-svn_repos_fs_change_rev_prop3(svn_repos_t *repos,
+svn_repos_fs_change_rev_prop4(svn_repos_t *repos,
                               svn_revnum_t rev,
                               const char *author,
                               const char *name,
+                              const svn_string_t *const *old_value_p,
                               const svn_string_t *new_value,
                               svn_boolean_t use_pre_revprop_change_hook,
                               svn_boolean_t use_post_revprop_change_hook,
@@ -274,7 +275,6 @@ svn_repos_fs_change_rev_prop3(svn_repos_
                               void *authz_read_baton,
                               apr_pool_t *pool)
 {
-  svn_string_t *old_value;
   svn_repos_revision_access_level_t readability;
   char action;
 
@@ -284,9 +284,26 @@ svn_repos_fs_change_rev_prop3(svn_repos_
 
   if (readability == svn_repos_revision_access_full)
     {
+      const svn_string_t *old_value;
+
       SVN_ERR(validate_prop(name, new_value, pool));
-      SVN_ERR(svn_fs_revision_prop(&old_value, repos->fs, rev, name, pool));
 
+      /* Fetch OLD_VALUE for svn_fs_change_rev_prop2(). */
+      if (old_value_p)
+        {
+          old_value = *old_value_p;
+        }
+      else
+        {
+          /* Get OLD_VALUE anyway, in order for ACTION and OLD_VALUE arguments
+           * to the hooks to be accurate. */
+          svn_string_t *old_value2;
+
+          SVN_ERR(svn_fs_revision_prop(&old_value2, repos->fs, rev, name, pool));
+          old_value = old_value2; 
+        }
+
+      /* Prepare ACTION. */
       if (! new_value)
         action = 'D';
       else if (! old_value)
@@ -294,12 +311,13 @@ svn_repos_fs_change_rev_prop3(svn_repos_
       else
         action = 'M';
 
+      /* ### currently not passing the old_value to hooks */
       if (use_pre_revprop_change_hook)
         SVN_ERR(svn_repos__hooks_pre_revprop_change(repos, rev, author, name,
                                                     new_value, action, pool));
 
-      SVN_ERR(svn_fs_change_rev_prop2(repos->fs, rev, name, NULL, 
-                                      new_value, pool));
+      SVN_ERR(svn_fs_change_rev_prop2(repos->fs, rev, name,
+                                      &old_value, new_value, pool));
 
       if (use_post_revprop_change_hook)
         SVN_ERR(svn_repos__hooks_post_revprop_change(repos, rev, author,  name,



Re: svn commit: r967212 - in /subversion/branches/atomic-revprop/subversion: include/svn_repos.h libsvn_repos/deprecated.c libsvn_repos/fs-wrap.c

Posted by Daniel Shahaf <da...@apache.org>.
C. Michael Pilato wrote on Fri, Jul 23, 2010 at 15:15:37 -0400:
> On 07/23/2010 03:13 PM, danielsh@apache.org wrote:
> > Author: danielsh
> > Date: Fri Jul 23 19:13:52 2010
> > New Revision: 967212
> 
> [...]
> 
> > * subversion/libsvn_repos/deprecated.c
> >   (svn_repos_fs_change_rev_prop3):
> >     Reimplement as wrapper around svn_repos_fs_change_rev_prop3().
>                                                                ^^^ 4?
> 

Fixed.

(It took you one minute and forty-five seconds.)

Thanks,

Daniel

> -- 
> C. Michael Pilato <cm...@collab.net>
> CollabNet   <>   www.collab.net   <>   Distributed Development On Demand
> 



Re: svn commit: r967212 - in /subversion/branches/atomic-revprop/subversion: include/svn_repos.h libsvn_repos/deprecated.c libsvn_repos/fs-wrap.c

Posted by Daniel Shahaf <da...@apache.org>.
C. Michael Pilato wrote on Fri, Jul 23, 2010 at 15:15:37 -0400:
> On 07/23/2010 03:13 PM, danielsh@apache.org wrote:
> > Author: danielsh
> > Date: Fri Jul 23 19:13:52 2010
> > New Revision: 967212
> 
> [...]
> 
> > * subversion/libsvn_repos/deprecated.c
> >   (svn_repos_fs_change_rev_prop3):
> >     Reimplement as wrapper around svn_repos_fs_change_rev_prop3().
>                                                                ^^^ 4?
> 

Fixed.

(It took you one minute and forty-five seconds.)

Thanks,

Daniel

> -- 
> C. Michael Pilato <cm...@collab.net>
> CollabNet   <>   www.collab.net   <>   Distributed Development On Demand
> 


Re: svn commit: r967212 - in /subversion/branches/atomic-revprop/subversion: include/svn_repos.h libsvn_repos/deprecated.c libsvn_repos/fs-wrap.c

Posted by "C. Michael Pilato" <cm...@collab.net>.
On 07/23/2010 03:13 PM, danielsh@apache.org wrote:
> Author: danielsh
> Date: Fri Jul 23 19:13:52 2010
> New Revision: 967212

[...]

> * subversion/libsvn_repos/deprecated.c
>   (svn_repos_fs_change_rev_prop3):
>     Reimplement as wrapper around svn_repos_fs_change_rev_prop3().
                                                               ^^^ 4?

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand


Re: svn commit: r967212 - in /subversion/branches/atomic-revprop/subversion: include/svn_repos.h libsvn_repos/deprecated.c libsvn_repos/fs-wrap.c

Posted by "C. Michael Pilato" <cm...@collab.net>.
On 07/23/2010 03:13 PM, danielsh@apache.org wrote:
> Author: danielsh
> Date: Fri Jul 23 19:13:52 2010
> New Revision: 967212

[...]

> * subversion/libsvn_repos/deprecated.c
>   (svn_repos_fs_change_rev_prop3):
>     Reimplement as wrapper around svn_repos_fs_change_rev_prop3().
                                                               ^^^ 4?

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand