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:30:28 UTC

svn commit: r983234 - /subversion/branches/atomic-revprop/subversion/libsvn_client/prop_commands.c

Author: danielsh
Date: Sat Aug  7 14:30:28 2010
New Revision: 983234

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

Extract a helper from svn_client_revprop_set2().

* subversion/libsvn_client/prop_commands.c
  (check_and_set_revprop):  New helper, extracted unchanged from...
  (svn_client_revprop_set2): ... here.

Modified:
    subversion/branches/atomic-revprop/subversion/libsvn_client/prop_commands.c

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=983234&r1=983233&r2=983234&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:30:28 2010
@@ -445,41 +445,14 @@ svn_client_propset4(const char *propname
     }
 }
 
-svn_error_t *
-svn_client_revprop_set2(const char *propname,
-                        const svn_string_t *propval,
-                        const svn_string_t *original_propval,
-                        const char *URL,
-                        const svn_opt_revision_t *revision,
-                        svn_revnum_t *set_rev,
-                        svn_boolean_t force,
-                        svn_client_ctx_t *ctx,
-                        apr_pool_t *pool)
+static svn_error_t *
+check_and_set_revprop(svn_revnum_t *set_rev,
+                      svn_ra_session_t *ra_session,
+                      const char *propname,
+                      const svn_string_t *original_propval,
+                      const svn_string_t *propval,
+                      apr_pool_t *pool)
 {
-  svn_ra_session_t *ra_session;
-
-  if ((strcmp(propname, SVN_PROP_REVISION_AUTHOR) == 0)
-      && propval
-      && strchr(propval->data, '\n') != NULL
-      && (! force))
-    return svn_error_create(SVN_ERR_CLIENT_REVISION_AUTHOR_CONTAINS_NEWLINE,
-                            NULL, _("Author name should not contain a newline;"
-                                    " value will not be set unless forced"));
-
-  if (propval && ! svn_prop_name_is_valid(propname))
-    return svn_error_createf(SVN_ERR_CLIENT_PROPERTY_NAME, NULL,
-                             _("Bad property name: '%s'"), propname);
-
-  /* Open an RA session for the URL. Note that we don't have a local
-     directory, nor a place to put temp files. */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, URL, NULL,
-                                               NULL, FALSE, TRUE, ctx, pool));
-
-  /* Resolve the revision into something real, and return that to the
-     caller as well. */
-  SVN_ERR(svn_client__get_revision_number(set_rev, NULL, ctx->wc_ctx, NULL,
-                                          ra_session, revision, pool));
-
   if (original_propval)
     {
       /* Ensure old value hasn't changed behind our back. */
@@ -514,8 +487,49 @@ svn_client_revprop_set2(const char *prop
     }
 
   /* The actual RA call. */
-  SVN_ERR(svn_ra_change_rev_prop(ra_session, *set_rev, propname, propval,
-                                 pool));
+  SVN_ERR(svn_ra_change_rev_prop(ra_session, *set_rev, propname, 
+                                 propval, pool));
+
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_client_revprop_set2(const char *propname,
+                        const svn_string_t *propval,
+                        const svn_string_t *original_propval,
+                        const char *URL,
+                        const svn_opt_revision_t *revision,
+                        svn_revnum_t *set_rev,
+                        svn_boolean_t force,
+                        svn_client_ctx_t *ctx,
+                        apr_pool_t *pool)
+{
+  svn_ra_session_t *ra_session;
+
+  if ((strcmp(propname, SVN_PROP_REVISION_AUTHOR) == 0)
+      && propval
+      && strchr(propval->data, '\n') != NULL
+      && (! force))
+    return svn_error_create(SVN_ERR_CLIENT_REVISION_AUTHOR_CONTAINS_NEWLINE,
+                            NULL, _("Author name should not contain a newline;"
+                                    " value will not be set unless forced"));
+
+  if (propval && ! svn_prop_name_is_valid(propname))
+    return svn_error_createf(SVN_ERR_CLIENT_PROPERTY_NAME, NULL,
+                             _("Bad property name: '%s'"), propname);
+
+  /* Open an RA session for the URL. Note that we don't have a local
+     directory, nor a place to put temp files. */
+  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, URL, NULL,
+                                               NULL, FALSE, TRUE, ctx, pool));
+
+  /* Resolve the revision into something real, and return that to the
+     caller as well. */
+  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));
 
   if (ctx->notify_func2)
     {