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/09/20 12:36:29 UTC

svn commit: r998880 - in /subversion/trunk/subversion: include/svn_error_codes.h include/svn_fs.h libsvn_fs_base/revs-txns.c libsvn_fs_fs/fs_fs.c tests/libsvn_fs/fs-test.c

Author: danielsh
Date: Mon Sep 20 10:36:29 2010
New Revision: 998880

URL: http://svn.apache.org/viewvc?rev=998880&view=rev
Log:
Use a new, distinct error code if svn_fs_change_rev_prop2's old_value_p
doesn't match.

* subversion/include/svn_error_codes.h
  (SVN_ERR_BAD_OLD_VALUE): New error code.

* subversion/libsvn_fs_fs/fs_fs.c
  (change_rev_prop_body): Use SVN_ERR_BAD_OLD_VALUE when appropriate.

* subversion/libsvn_fs_base/revs-txns.c
  (svn_fs_base__set_rev_prop): Use SVN_ERR_BAD_OLD_VALUE when appropriate.

* subversion/include/svn_fs.h
  (svn_fs_change_rev_prop2): Update documentation.

* subversion/tests/libsvn_fs/fs-test.c
  (FAILS_WITH_BPV): Rename to...
  (FAILS_WITH_BOV): ... this.  Change to test for SVN_ERR_BAD_OLD_VALUE.
  (revision_props): Change to use FAILS_WITH_BOV instead of FAILS_WITH_BPV.

Patch by: Jon Foster <jo...@cabot.co.uk>

Modified:
    subversion/trunk/subversion/include/svn_error_codes.h
    subversion/trunk/subversion/include/svn_fs.h
    subversion/trunk/subversion/libsvn_fs_base/revs-txns.c
    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
    subversion/trunk/subversion/tests/libsvn_fs/fs-test.c

Modified: subversion/trunk/subversion/include/svn_error_codes.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_error_codes.h?rev=998880&r1=998879&r2=998880&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_error_codes.h (original)
+++ subversion/trunk/subversion/include/svn_error_codes.h Mon Sep 20 10:36:29 2010
@@ -219,6 +219,11 @@ SVN_ERROR_START
              SVN_ERR_BAD_CATEGORY_START + 13,
              "Unknown string value of token")
 
+  /** @since New in 1.7. */
+  SVN_ERRDEF(SVN_ERR_BAD_OLD_VALUE,
+             SVN_ERR_BAD_CATEGORY_START + 14,
+             "Old value doesn't match repository")
+
   /* xml errors */
 
   SVN_ERRDEF(SVN_ERR_XML_ATTRIB_NOT_FOUND,

Modified: subversion/trunk/subversion/include/svn_fs.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_fs.h?rev=998880&r1=998879&r2=998880&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_fs.h (original)
+++ subversion/trunk/subversion/include/svn_fs.h Mon Sep 20 10:36:29 2010
@@ -1896,8 +1896,8 @@ svn_fs_revision_proplist(apr_hash_t **ta
  * - @a name is the name of the property to change.
  * - if @a old_value_p is not @c NULL, then @a *old_value_p is the expected old
  *   value of the property, and changing the value will fail with error
- *   #SVN_ERR_BAD_PROPERTY_VALUE if the present value of the property is not @a
- *   *old_value_p.
+ *   #SVN_ERR_BAD_OLD_VALUE if the present value of the property is not @a
+ *   *old_value_p.  (This is an atomic test-and-set).
  * - @a value is the new value of the property, or zero if the property should
  *   be removed altogether.
  *

Modified: subversion/trunk/subversion/libsvn_fs_base/revs-txns.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_base/revs-txns.c?rev=998880&r1=998879&r2=998880&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_base/revs-txns.c (original)
+++ subversion/trunk/subversion/libsvn_fs_base/revs-txns.c Mon Sep 20 10:36:29 2010
@@ -270,7 +270,7 @@ svn_fs_base__set_rev_prop(svn_fs_t *fs,
               && !svn_string_compare(wanted_value, present_value)))
         {
           /* What we expected isn't what we found. */
-          return svn_error_createf(SVN_ERR_BAD_PROPERTY_VALUE, NULL,
+          return svn_error_createf(SVN_ERR_BAD_OLD_VALUE, NULL,
                                    _("revprop '%s' has unexpected value in "
                                      "filesystem"),
                                    name);

Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=998880&r1=998879&r2=998880&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Mon Sep 20 10:36:29 2010
@@ -7312,7 +7312,7 @@ change_rev_prop_body(void *baton, apr_po
               && !svn_string_compare(wanted_value, present_value)))
         {
           /* What we expected isn't what we found. */
-          return svn_error_createf(SVN_ERR_BAD_PROPERTY_VALUE, NULL,
+          return svn_error_createf(SVN_ERR_BAD_OLD_VALUE, NULL,
                                    _("revprop '%s' has unexpected value in "
                                      "filesystem"),
                                    cb->name);

Modified: subversion/trunk/subversion/tests/libsvn_fs/fs-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_fs/fs-test.c?rev=998880&r1=998879&r2=998880&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_fs/fs-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_fs/fs-test.c Mon Sep 20 10:36:29 2010
@@ -586,12 +586,12 @@ list_directory(const svn_test_opts_t *op
 }
 
 
-/* If EXPR raises SVN_ERR_BAD_PROPERTY_VALUE, continue; else, fail
+/* If EXPR raises SVN_ERR_BAD_OLD_VALUE, continue; else, fail
  * the test. */
-#define FAILS_WITH_BPV(expr) \
+#define FAILS_WITH_BOV(expr) \
   do { \
       svn_error_t *__err = (expr); \
-      if (!__err || __err->apr_err != SVN_ERR_BAD_PROPERTY_VALUE) \
+      if (!__err || __err->apr_err != SVN_ERR_BAD_OLD_VALUE) \
         return svn_error_create(SVN_ERR_TEST_FAILED, __err, \
                                 "svn_fs_change_rev_prop2() failed to " \
                                 "detect unexpected old value"); \
@@ -662,18 +662,18 @@ revision_props(const svn_test_opts_t *op
 
       /* Value of "flower" is 's1'. */
 
-      FAILS_WITH_BPV(svn_fs_change_rev_prop2(fs, 0, "flower", &s2_p, s1_p, pool));
+      FAILS_WITH_BOV(svn_fs_change_rev_prop2(fs, 0, "flower", &s2_p, s1_p, pool));
       s1_dup = svn_string_dup(&s1, pool);
       SVN_ERR(svn_fs_change_rev_prop2(fs, 0, "flower", &s1_dup, s2_p, pool));
 
       /* Value of "flower" is 's2'. */
 
-      FAILS_WITH_BPV(svn_fs_change_rev_prop2(fs, 0, "flower", &s1_p, NULL, pool));
+      FAILS_WITH_BOV(svn_fs_change_rev_prop2(fs, 0, "flower", &s1_p, NULL, pool));
       SVN_ERR(svn_fs_change_rev_prop2(fs, 0, "flower", &s2_p, NULL, pool));
 
       /* Value of "flower" is <not set>. */
 
-      FAILS_WITH_BPV(svn_fs_change_rev_prop2(fs, 0, "flower", &s2_p, s1_p, pool));
+      FAILS_WITH_BOV(svn_fs_change_rev_prop2(fs, 0, "flower", &s2_p, s1_p, pool));
       SVN_ERR(svn_fs_change_rev_prop2(fs, 0, "flower", &unset, s1_p, pool));
 
       /* Value of "flower" is 's1'. */



Re: svn commit: r998880 - in /subversion/trunk/subversion: include/svn_error_codes.h include/svn_fs.h libsvn_fs_base/revs-txns.c libsvn_fs_fs/fs_fs.c tests/libsvn_fs/fs-test.c

Posted by Blair Zajac <bl...@orcaware.com>.
On 09/20/2010 03:36 AM, danielsh@apache.org wrote:
> Author: danielsh
> Date: Mon Sep 20 10:36:29 2010
> New Revision: 998880
>
> URL: http://svn.apache.org/viewvc?rev=998880&view=rev
> Log:
> Use a new, distinct error code if svn_fs_change_rev_prop2's old_value_p
> doesn't match.
>
> * subversion/include/svn_error_codes.h
>    (SVN_ERR_BAD_OLD_VALUE): New error code.

I wouldn't call it a "BAD" old value, it's just an outdated old value.

Just some ideas here, maybe move it out of the 
SVN_ERR_BAD_CATEGORY_START into SVN_ERR_MISC_CATEGORY_START or 
SVN_ERR_FS_CATEGORY_START?

There's a SVN_ERR_FS_REP_CHANGED error, maybe use 
SVN_ERR_FS_PROPERTY_CHANGED?

Or using SVN_ERR_FS_TXN_OUT_OF_DATE as a model, 
SVN_ERR_FS_PROPERTY_VALUE_OUT_OF_DATE?

Blair