You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/02/24 19:31:38 UTC

svn commit: r1449524 - in /subversion/trunk/subversion: include/svn_client.h libsvn_client/deprecated.c libsvn_client/prop_commands.c svn/proplist-cmd.c

Author: rhuijben
Date: Sun Feb 24 18:31:38 2013
New Revision: 1449524

URL: http://svn.apache.org/r1449524
Log:
Remove a result_pool argument from a new in 1.8 function that doesn't have
output arguments. Values passed to a callback shouldn't be allocated in a
global result pool, but in some iterpool. Storing everything in a result
hash breaks the streamy api pattern.

* subversion/include/svn_client.h
  (svn_client_proplist4): Remove result_pool.

* subversion/libsvn_client/deprecated.c
  (svn_client_proplist3): Update caller.

* subversion/libsvn_client/prop_commands.c
  (pristine_or_working_props): Remove function. Fold in only caller.
  (remote_proplist): Add cancel_func. Remove result pool. Don't duplicate the
    entire hash to remove 3 or 4 entry props. Handle cancelation.
    Rename subpool to iterpool.
  (get_remote_props): Remove result pool. Update caller.
  (get_local_props): Fold in pristine_or_working_props.
  (svn_client_proplist4): Remove argument. Fix typo.

* subversion/svn/proplist-cmd.c
  (svn_cl__proplist): Update caller.

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/proplist-cmd.c

Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1449524&r1=1449523&r2=1449524&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Sun Feb 24 18:31:38 2013
@@ -5183,7 +5183,6 @@ svn_client_proplist4(const char *target,
                      svn_proplist_receiver2_t receiver,
                      void *receiver_baton,
                      svn_client_ctx_t *ctx,
-                     apr_pool_t *result_pool,
                      apr_pool_t *scratch_pool);
 
 /**

Modified: subversion/trunk/subversion/libsvn_client/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/deprecated.c?rev=1449524&r1=1449523&r2=1449524&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_client/deprecated.c Sun Feb 24 18:31:38 2013
@@ -2115,7 +2115,7 @@ svn_client_proplist3(const char *target,
   return svn_error_trace(svn_client_proplist4(target, peg_revision, revision,
                                               depth, changelists, FALSE,
                                               receiver2, receiver2_baton,
-                                              ctx, pool, pool));
+                                              ctx, pool));
 }
 
 /* Receiver baton used by proplist2() */

Modified: subversion/trunk/subversion/libsvn_client/prop_commands.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/prop_commands.c?rev=1449524&r1=1449523&r2=1449524&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/trunk/subversion/libsvn_client/prop_commands.c Sun Feb 24 18:31:38 2013
@@ -520,51 +520,6 @@ svn_client_revprop_set2(const char *prop
   return SVN_NO_ERROR;
 }
 
-
-/* Set *PROPS to the pristine (base) properties at LOCAL_ABSPATH, if PRISTINE
- * is true, or else the working value if PRISTINE is false.
- *
- * The keys of *PROPS will be 'const char *' property names, and the
- * values 'const svn_string_t *' property values.  Allocate *PROPS
- * and its contents in RESULT_POOL.  Use SCRATCH_POOL for temporary
- * allocations.
- */
-static svn_error_t *
-pristine_or_working_props(apr_hash_t **props,
-                          svn_wc_context_t *wc_ctx,
-                          const char *local_abspath,
-                          svn_boolean_t pristine,
-                          apr_pool_t *result_pool,
-                          apr_pool_t *scratch_pool)
-{
-  if (pristine)
-    {
-      return svn_error_trace(svn_wc_get_pristine_props(props,
-                                                       wc_ctx,
-                                                       local_abspath,
-                                                       result_pool,
-                                                       scratch_pool));
-    }
-
-  /* ### until svn_wc_prop_list2() returns a NULL value for locally-deleted
-     ### nodes, then let's check manually.  */
-  {
-    svn_boolean_t deleted;
-
-    SVN_ERR(svn_wc__node_is_status_deleted(&deleted, wc_ctx, local_abspath,
-                                           scratch_pool));
-    if (deleted)
-      {
-        *props = NULL;
-        return SVN_NO_ERROR;
-      }
-  }
-
-  return svn_error_trace(svn_wc_prop_list2(props, wc_ctx, local_abspath,
-                                           result_pool, scratch_pool));
-}
-
-
 /* Helper for the remote case of svn_client_propget.
  *
  * If PROPS is not null, then get the value of property PROPNAME in REVNUM,
@@ -1107,12 +1062,12 @@ remote_proplist(const char *target_prefi
                 svn_depth_t depth,
                 svn_proplist_receiver2_t receiver,
                 void *receiver_baton,
-                apr_pool_t *result_pool,
+                svn_cancel_func_t cancel_func,
+                void *cancel_baton,
                 apr_pool_t *scratch_pool)
 {
   apr_hash_t *dirents;
   apr_hash_t *prop_hash = NULL;
-  apr_hash_t *final_hash = NULL;
   apr_hash_index_t *hi;
   const char *target_full_url =
     svn_path_url_add_component2(target_prefix, target_relative, scratch_pool);
@@ -1146,12 +1101,12 @@ remote_proplist(const char *target_prefi
 
       SVN_ERR(svn_ra_get_inherited_props(ra_session, &inherited_props,
                                          target_relative, revnum,
-                                         result_pool, scratch_pool));
+                                         scratch_pool, scratch_pool));
       SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_root_url,
                                      scratch_pool));
       SVN_ERR(svn_client__iprop_relpaths_to_urls(inherited_props,
                                                  repos_root_url,
-                                                 result_pool,
+                                                 scratch_pool,
                                                  scratch_pool));
     }
   else
@@ -1159,41 +1114,39 @@ remote_proplist(const char *target_prefi
       inherited_props = NULL;
     }
 
-  if (get_explicit_props)
+  if (!get_explicit_props)
+    prop_hash = NULL;
+  else
     {
       /* Filter out non-regular properties, since the RA layer returns all
          kinds.  Copy regular properties keys/vals from the prop_hash
          allocated in SCRATCH_POOL to the "final" hash allocated in
          RESULT_POOL. */
-      final_hash = apr_hash_make(result_pool);
       for (hi = apr_hash_first(scratch_pool, prop_hash);
            hi;
            hi = apr_hash_next(hi))
         {
           const char *name = svn__apr_hash_index_key(hi);
           apr_ssize_t klen = svn__apr_hash_index_klen(hi);
-          svn_string_t *value = svn__apr_hash_index_val(hi);
           svn_prop_kind_t prop_kind;
-
+    
           prop_kind = svn_property_kind2(name);
-
-          if (prop_kind == svn_prop_regular_kind)
+    
+          if (prop_kind != svn_prop_regular_kind)
             {
-              name = apr_pstrdup(result_pool, name);
-              value = svn_string_dup(value, result_pool);
-              apr_hash_set(final_hash, name, klen, value);
+              apr_hash_set(prop_hash, name, klen, NULL);
             }
-        }  
+        }
     }
 
-  SVN_ERR(call_receiver(target_full_url, final_hash, inherited_props,
-                        receiver, receiver_baton, result_pool));
+  SVN_ERR(call_receiver(target_full_url, prop_hash, inherited_props,
+                        receiver, receiver_baton, scratch_pool));
 
   if (depth > svn_depth_empty
       && get_explicit_props
       && (kind == svn_node_dir) && (apr_hash_count(dirents) > 0))
     {
-      apr_pool_t *subpool = svn_pool_create(scratch_pool);
+      apr_pool_t *iterpool = svn_pool_create(scratch_pool);
 
       for (hi = apr_hash_first(scratch_pool, dirents);
            hi;
@@ -1203,10 +1156,13 @@ remote_proplist(const char *target_prefi
           svn_dirent_t *this_ent = svn__apr_hash_index_val(hi);
           const char *new_target_relative;
 
-          svn_pool_clear(subpool);
+          if (cancel_func)
+            SVN_ERR(cancel_func(cancel_baton));
+
+          svn_pool_clear(iterpool);
 
           new_target_relative = svn_relpath_join(target_relative,
-                                                 this_name, subpool);
+                                                 this_name, iterpool);
 
           if (this_ent->kind == svn_node_file
               || depth > svn_depth_files)
@@ -1221,17 +1177,16 @@ remote_proplist(const char *target_prefi
                                       this_ent->kind,
                                       revnum,
                                       ra_session,
-                                      TRUE,
-                                      FALSE,
+                                      TRUE /* get_explicit_props */,
+                                      FALSE /* get_target_inherited_props */,
                                       depth_below_here,
-                                      receiver,
-                                      receiver_baton,
-                                      result_pool,
-                                      subpool));
+                                      receiver, receiver_baton,
+                                      cancel_func, cancel_baton,
+                                      iterpool));
             }
         }
 
-      svn_pool_destroy(subpool);
+      svn_pool_destroy(iterpool);
     }
 
   return SVN_NO_ERROR;
@@ -1292,7 +1247,6 @@ get_remote_props(const char *path_or_url
                  svn_proplist_receiver2_t receiver,
                  void *receiver_baton,
                  svn_client_ctx_t *ctx,
-                 apr_pool_t *result_pool,
                  apr_pool_t *scratch_pool)
 {
   svn_ra_session_t *ra_session;
@@ -1329,7 +1283,7 @@ get_remote_props(const char *path_or_url
                                           ctx->wc_ctx,
                                           local_abspath,
                                           FALSE, /* scan_deleted */
-                                          result_pool,
+                                          scratch_pool,
                                           scratch_pool));
           if (repos_relpath)
             {
@@ -1382,16 +1336,17 @@ get_remote_props(const char *path_or_url
                                             path_or_url, NULL,
                                             peg_revision,
                                             revision, ctx,
-                                            result_pool));
+                                            scratch_pool));
 
   SVN_ERR(svn_ra_check_path(ra_session, "", loc->rev, &kind,
-                            result_pool));
+                            scratch_pool));
 
   SVN_ERR(remote_proplist(loc->url, "", kind, loc->rev, ra_session,
                           get_explicit_props,
                           get_target_inherited_props,
                           depth, receiver, receiver_baton,
-                          result_pool, scratch_pool));
+                          ctx->cancel_func, ctx->cancel_baton,
+                          scratch_pool));
   return SVN_NO_ERROR;
 }
 
@@ -1407,7 +1362,6 @@ get_local_props(const char *path_or_url,
                 svn_proplist_receiver2_t receiver,
                 void *receiver_baton,
                 svn_client_ctx_t *ctx,
-                apr_pool_t *result_pool,
                 apr_pool_t *scratch_pool)
 {
   svn_boolean_t pristine;
@@ -1477,18 +1431,38 @@ get_local_props(const char *path_or_url,
       SVN_ERR(svn_wc__prop_list_recursive(ctx->wc_ctx, local_abspath, NULL,
                                           depth, pristine, changelists,
                                           recursive_proplist_receiver, &rb,
-                                          ctx->cancel_func,
-                                          ctx->cancel_baton, result_pool));
+                                          ctx->cancel_func, ctx->cancel_baton,
+                                          scratch_pool));
     }
   else if (svn_wc__changelist_match(ctx->wc_ctx, local_abspath,
                                     changelist_hash, scratch_pool))
     {
-      apr_hash_t *hash;
+      apr_hash_t *props;
+
+        if (pristine)
+          SVN_ERR(svn_wc_get_pristine_props(&props,
+                                            ctx->wc_ctx, local_abspath,
+                                            scratch_pool, scratch_pool));
+        else
+          {
+            svn_error_t *err;
+
+            err = svn_wc_prop_list2(&props, ctx->wc_ctx, local_abspath,
+                                    scratch_pool, scratch_pool);
+
+
+            if (err)
+              {
+                if (err->apr_err != SVN_ERR_WC_PATH_UNEXPECTED_STATUS)
+                  return svn_error_trace(err);
+                /* As svn_wc_prop_list2() doesn't return NULL for locally-deleted
+                   let's do that here.  */
+                svn_error_clear(err);
+                props = apr_hash_make(scratch_pool);
+              }
+          }
 
-      SVN_ERR(pristine_or_working_props(&hash, ctx->wc_ctx, local_abspath,
-                                        pristine, result_pool,
-                                        scratch_pool));
-      SVN_ERR(call_receiver(path_or_url, hash, NULL,
+      SVN_ERR(call_receiver(path_or_url, props, NULL,
                             receiver, receiver_baton, scratch_pool));
 
     }
@@ -1505,7 +1479,6 @@ svn_client_proplist4(const char *path_or
                      svn_proplist_receiver2_t receiver,
                      void *receiver_baton,
                      svn_client_ctx_t *ctx,
-                     apr_pool_t *result_pool,
                      apr_pool_t *scratch_pool)
 {
   svn_boolean_t local_explicit_props;
@@ -1524,7 +1497,7 @@ svn_client_proplist4(const char *path_or
      && SVN_CLIENT__REVKIND_IS_LOCAL_TO_WC(peg_revision->kind)
      && SVN_CLIENT__REVKIND_IS_LOCAL_TO_WC(revision->kind));
 
-  /* If we want iprops are they avaiable locally? */
+  /* If we want iprops are they available locally? */
   local_iprops =
     (get_target_inherited_props /* We want iprops */
      && local_explicit_props /* No local explicit props means no local iprops. */
@@ -1539,15 +1512,14 @@ svn_client_proplist4(const char *path_or
       SVN_ERR(get_remote_props(path_or_url, peg_revision, revision, depth,
                                !local_explicit_props,
                                (get_target_inherited_props && !local_iprops),
-                               receiver, receiver_baton, ctx, result_pool,
-                               scratch_pool));
+                               receiver, receiver_baton, ctx, scratch_pool));
     }
 
   if (local_explicit_props)
     {
       SVN_ERR(get_local_props(path_or_url, revision, depth, changelists,
                               local_iprops, receiver, receiver_baton, ctx,
-                              result_pool, scratch_pool));
+                              scratch_pool));
     }
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/svn/proplist-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/proplist-cmd.c?rev=1449524&r1=1449523&r2=1449524&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/proplist-cmd.c (original)
+++ subversion/trunk/subversion/svn/proplist-cmd.c Sun Feb 24 18:31:38 2013
@@ -295,7 +295,7 @@ svn_cl__proplist(apr_getopt_t *os,
                                         opt_state->changelists,
                                         opt_state->show_inherited_props,
                                         pl_receiver, &pl_baton,
-                                        ctx, iterpool, iterpool),
+                                        ctx, iterpool),
                    errors, opt_state->quiet,
                    SVN_ERR_UNVERSIONED_RESOURCE,
                    SVN_ERR_ENTRY_NOT_FOUND,