subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r966720 - in /subversion/trunk/subversion: include/svn_client.h libsvn_client/deprecated.c libsvn_client/prop_commands.c svn/propdel-cmd.c svn/propedit-cmd.c svn/propset-cmd.c
Date Thu, 22 Jul 2010 16:07:17 GMT
Author: hwright
Date: Thu Jul 22 16:07:17 2010
New Revision: 966720

URL: http://svn.apache.org/viewvc?rev=966720&view=rev
Log:
Finish rev'ing the client commit APIs by making the propset API return
commit info back through the client context callback.

* subversion/svn/propdel-cmd.c
  (svn_cl__propdel): Use the updated API.

* subversion/svn/propset-cmd.c
  (svn_cl__propset): Same.

* subversion/svn/propedit-cmd.c
  (commit_info_baton, commit_info_handler): New.
  (svn_cl__propedit): Use the new API, and define a dummy callback to
    maintain output compat.

* subversion/include/svn_client.h
  (svn_client_propset4): New.
  (svn_client_propset3): Deprecate.

* subversion/libsvn_client/deprecated.c
  (svn_client_propset3): New wrapper.

* subversion/libsvn_client/prop_commands.c
  (propset_on_url): Remove commit_info param, use the context callback and
    baton on commit.
  (svn_client_propset3): Remove.
  (svn_client_propset4): New.

Modified:
    subversion/trunk/subversion/include/svn_client.h
    subversion/trunk/subversion/libsvn_client/deprecated.c
    subversion/trunk/subversion/libsvn_client/prop_commands.c
    subversion/trunk/subversion/svn/propdel-cmd.c
    subversion/trunk/subversion/svn/propedit-cmd.c
    subversion/trunk/subversion/svn/propset-cmd.c

Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=966720&r1=966719&r2=966720&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Thu Jul 22 16:07:17 2010
@@ -3971,8 +3971,7 @@ svn_client_move(svn_client_commit_info_t
  * supported on URLs.  The authentication baton in @a ctx and @a
  * ctx->log_msg_func3/@a ctx->log_msg_baton3 will be used to
  * immediately attempt to commit the property change in the
- * repository.  If the commit succeeds, allocate (in @a pool) and
- * populate @a *commit_info_p.
+ * repository.
  *
  * If @a propname is an svn-controlled property (i.e. prefixed with
  * #SVN_PROP_PREFIX), then the caller is responsible for ensuring that
@@ -4000,10 +3999,34 @@ svn_client_move(svn_client_commit_info_t
  * If @a ctx->cancel_func is non-NULL, invoke it passing @a
  * ctx->cancel_baton at various places during the operation.
  *
+ * If @a ctx->commit_callback2 is non-NULL, then for each successful commit,
+ * call @a ctx->commit_callback2 with @a ctx->commit_baton and a
+ * #svn_commit_info_t for the commit.
+ *
  * Use @a pool for all memory allocation.
  *
+ * @since New in 1.7.
+ */
+svn_error_t *
+svn_client_propset4(const char *propname,
+                    const svn_string_t *propval,
+                    const char *target,
+                    svn_depth_t depth,
+                    svn_boolean_t skip_checks,
+                    svn_revnum_t base_revision_for_url,
+                    const apr_array_header_t *changelists,
+                    const apr_hash_t *revprop_table,
+                    svn_client_ctx_t *ctx,
+                    apr_pool_t *pool);
+
+/**
+ * Similar to svn_client_propset4(), but returns the @a commit_info_p directly,
+ * rather than through @a ctx->commit_callback2.
+ *
  * @since New in 1.5.
+ * @deprecated Provided for backward compatibility with the 1.6 API.
  */
+SVN_DEPRECATED
 svn_error_t *
 svn_client_propset3(svn_commit_info_t **commit_info_p,
                     const char *propname,
@@ -4016,7 +4039,6 @@ svn_client_propset3(svn_commit_info_t **
                     const apr_hash_t *revprop_table,
                     svn_client_ctx_t *ctx,
                     apr_pool_t *pool);
-
 /**
  * Like svn_client_propset3(), but with @a base_revision_for_url
  * always #SVN_INVALID_REVNUM; @a commit_info_p always @c NULL; @a

Modified: subversion/trunk/subversion/libsvn_client/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/deprecated.c?rev=966720&r1=966719&r2=966720&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_client/deprecated.c Thu Jul 22 16:07:17 2010
@@ -1475,6 +1475,36 @@ svn_client_merge_peg(const char *source,
 
 /*** From prop_commands.c ***/
 svn_error_t *
+svn_client_propset3(svn_commit_info_t **commit_info_p,
+                    const char *propname,
+                    const svn_string_t *propval,
+                    const char *target,
+                    svn_depth_t depth,
+                    svn_boolean_t skip_checks,
+                    svn_revnum_t base_revision_for_url,
+                    const apr_array_header_t *changelists,
+                    const apr_hash_t *revprop_table,
+                    svn_client_ctx_t *ctx,
+                    apr_pool_t *pool)
+{
+  svn_client_ctx_t shadow_ctx;
+  struct capture_baton_t cb;
+
+  cb.info = commit_info_p;
+  cb.pool = pool;
+  cb.original_callback = ctx->commit_callback2;
+  cb.original_baton = ctx->commit_baton;
+
+  shadow_ctx = *ctx;
+  shadow_ctx.commit_callback2 = capture_commit_info;
+  shadow_ctx.commit_baton = &cb;
+
+  return svn_client_propset4(propname, propval, target, depth, skip_checks,
+                             base_revision_for_url, changelists, revprop_table,
+                             &shadow_ctx, pool);
+}
+
+svn_error_t *
 svn_client_propset2(const char *propname,
                     const svn_string_t *propval,
                     const char *target,

Modified: subversion/trunk/subversion/libsvn_client/prop_commands.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/prop_commands.c?rev=966720&r1=966719&r2=966720&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/trunk/subversion/libsvn_client/prop_commands.c Thu Jul 22 16:07:17 2010
@@ -97,7 +97,7 @@ struct propset_walk_baton
   void *notify_baton;
 };
 
-/* An node-walk callback for svn_client_propset3.
+/* An node-walk callback for svn_client_propset4.
  *
  * For LOCAL_ABSPATH, set the property named wb->PROPNAME to the value
  * wb->PROPVAL, where "wb" is the WALK_BATON of type "struct
@@ -189,8 +189,7 @@ do_url_propset(const char *propname,
 }
 
 static svn_error_t *
-propset_on_url(svn_commit_info_t **commit_info_p,
-               const char *propname,
+propset_on_url(const char *propname,
                const svn_string_t *propval,
                const char *target,
                svn_boolean_t skip_checks,
@@ -204,7 +203,7 @@ propset_on_url(svn_commit_info_t **commi
   svn_node_kind_t node_kind;
   const char *message;
   const svn_delta_editor_t *editor;
-  void *commit_baton, *edit_baton;
+  void *edit_baton;
   apr_hash_t *commit_revprops;
   svn_error_t *err;
 
@@ -268,11 +267,10 @@ propset_on_url(svn_commit_info_t **commi
                                            message, ctx, pool));
 
   /* Fetch RA commit editor. */
-  SVN_ERR(svn_client__commit_get_baton(&commit_baton, commit_info_p, pool));
   SVN_ERR(svn_ra_get_commit_editor3(ra_session, &editor, &edit_baton,
                                     commit_revprops,
-                                    svn_client__commit_callback,
-                                    commit_baton,
+                                    ctx->commit_callback2,
+                                    ctx->commit_baton,
                                     NULL, TRUE, /* No lock tokens */
                                     pool));
 
@@ -303,7 +301,7 @@ struct set_props_baton
   apr_hash_t *changelist_hash;
 };
 
-/* Working copy lock callback for svn_client_propset3 */
+/* Working copy lock callback for svn_client_propset4 */
 static svn_error_t *
 set_props_cb(void *baton,
              apr_pool_t *result_pool,
@@ -339,8 +337,7 @@ set_props_cb(void *baton,
 }
 
 svn_error_t *
-svn_client_propset3(svn_commit_info_t **commit_info_p,
-                    const char *propname,
+svn_client_propset4(const char *propname,
                     const svn_string_t *propval,
                     const char *target,
                     svn_depth_t depth,
@@ -398,9 +395,8 @@ svn_client_propset3(svn_commit_info_t **
                                  _("Setting property '%s' on non-local target "
                                    "'%s' is not supported"), propname, target);
 
-      return propset_on_url(commit_info_p, propname, propval, target,
-                            skip_checks, base_revision_for_url, revprop_table,
-                            ctx, pool);
+      return propset_on_url(propname, propval, target, skip_checks,
+                            base_revision_for_url, revprop_table, ctx, pool);
     }
   else
     {

Modified: subversion/trunk/subversion/svn/propdel-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/propdel-cmd.c?rev=966720&r1=966719&r2=966720&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/propdel-cmd.c (original)
+++ subversion/trunk/subversion/svn/propdel-cmd.c Thu Jul 22 16:07:17 2010
@@ -129,15 +129,14 @@ svn_cl__propdel(apr_getopt_t *os,
       for (i = 0; i < targets->nelts; i++)
         {
           const char *target = APR_ARRAY_IDX(targets, i, const char *);
-          svn_commit_info_t *commit_info;
 
           svn_pool_clear(subpool);
           SVN_ERR(svn_cl__check_cancel(ctx->cancel_baton));
 
           /* Pass FALSE for 'skip_checks' because it doesn't matter here,
              and opt_state->force doesn't apply to this command anyway. */
-          SVN_ERR(svn_cl__try(svn_client_propset3
-                              (&commit_info, pname_utf8,
+          SVN_ERR(svn_cl__try(svn_client_propset4(
+                               pname_utf8,
                                NULL, target,
                                opt_state->depth,
                                FALSE, SVN_INVALID_REVNUM,

Modified: subversion/trunk/subversion/svn/propedit-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/propedit-cmd.c?rev=966720&r1=966719&r2=966720&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/propedit-cmd.c (original)
+++ subversion/trunk/subversion/svn/propedit-cmd.c Thu Jul 22 16:07:17 2010
@@ -45,6 +45,26 @@
 
 
 /*** Code. ***/
+struct commit_info_baton
+{
+  const char *pname_utf8;
+  const char *target_local;
+};
+
+static svn_error_t *
+commit_info_handler(const svn_commit_info_t *commit_info,
+                    void *baton,
+                    apr_pool_t *pool)
+{
+  struct commit_info_baton *cib = baton;
+
+  SVN_ERR(svn_cmdline_printf(pool,
+                             _("Set new value for property '%s' on '%s'\n"),
+                             cib->pname_utf8, cib->target_local));
+  SVN_ERR(svn_cl__print_commit_info(commit_info, NULL, pool));
+
+  return SVN_NO_ERROR;
+}
 
 /* This implements the `svn_opt_subcommand_t' interface. */
 svn_error_t *
@@ -153,6 +173,7 @@ svn_cl__propedit(apr_getopt_t *os,
   else  /* operate on a normal, versioned property (not a revprop) */
     {
       apr_pool_t *subpool = svn_pool_create(pool);
+      struct commit_info_baton cib;
 
       /* The customary implicit dot rule has been prone to user error
        * here.  For example, Jon Trowbridge <trow@gnu.og> did
@@ -178,6 +199,8 @@ svn_cl__propedit(apr_getopt_t *os,
 
       SVN_ERR(svn_cl__eat_peg_revisions(&targets, targets, pool));
 
+      cib.pname_utf8 = pname_utf8;
+
       /* For each target, edit the property PNAME. */
       for (i = 0; i < targets->nelts; i++)
         {
@@ -255,11 +278,14 @@ svn_cl__propedit(apr_getopt_t *os,
 
           target_local = svn_path_is_url(target) ? target
             : svn_dirent_local_style(target, subpool);
+          cib.target_local = target_local;
+
+          ctx->commit_callback2 = commit_info_handler;
+          ctx->commit_baton = &cib;
 
           /* ...and re-set the property's value accordingly. */
           if (edited_propval && !svn_string_compare(propval, edited_propval))
             {
-              svn_commit_info_t *commit_info = NULL;
               svn_error_t *err = SVN_NO_ERROR;
 
               svn_cl__check_boolean_prop_val(pname_utf8, edited_propval->data,
@@ -270,8 +296,7 @@ svn_cl__propedit(apr_getopt_t *os,
                                                    opt_state, NULL, ctx->config,
                                                    subpool));
 
-              err = svn_client_propset3(&commit_info,
-                                        pname_utf8, edited_propval, target,
+              err = svn_client_propset4(pname_utf8, edited_propval, target,
                                         svn_depth_empty, opt_state->force,
                                         base_rev, NULL, opt_state->revprop_table,
                                         ctx, subpool);
@@ -284,14 +309,10 @@ svn_cl__propedit(apr_getopt_t *os,
               /* Print a message if we successfully committed or if it
                  was just a wc propset (but not if the user aborted an URL
                  propedit). */
-              if (commit_info || ! svn_path_is_url(target))
-                SVN_ERR
-                  (svn_cmdline_printf
-                   (subpool, _("Set new value for property '%s' on '%s'\n"),
-                    pname_utf8, target_local));
-
-              if (commit_info && ! opt_state->quiet)
-                SVN_ERR(svn_cl__print_commit_info(commit_info, NULL, subpool));
+              if (!svn_path_is_url(target))
+                SVN_ERR(svn_cmdline_printf(
+                        subpool, _("Set new value for property '%s' on '%s'\n"),
+                        pname_utf8, target_local));
             }
           else
             {

Modified: subversion/trunk/subversion/svn/propset-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/propset-cmd.c?rev=966720&r1=966719&r2=966720&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/propset-cmd.c (original)
+++ subversion/trunk/subversion/svn/propset-cmd.c Thu Jul 22 16:07:17 2010
@@ -175,12 +175,11 @@ svn_cl__propset(apr_getopt_t *os,
       for (i = 0; i < targets->nelts; i++)
         {
           const char *target = APR_ARRAY_IDX(targets, i, const char *);
-          svn_commit_info_t *commit_info;
 
           svn_pool_clear(iterpool);
           SVN_ERR(svn_cl__check_cancel(ctx->cancel_baton));
-          SVN_ERR(svn_cl__try(svn_client_propset3
-                              (&commit_info, pname_utf8, propval, target,
+          SVN_ERR(svn_cl__try(svn_client_propset4(
+                               pname_utf8, propval, target,
                                opt_state->depth, opt_state->force,
                                SVN_INVALID_REVNUM, opt_state->changelists,
                                NULL, ctx, iterpool),



Mime
View raw message