You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2014/06/18 18:00:30 UTC

svn commit: r1603501 - in /subversion/trunk/subversion: include/svn_client.h libsvn_client/cat.c

Author: brane
Date: Wed Jun 18 16:00:29 2014
New Revision: 1603501

URL: http://svn.apache.org/r1603501
Log:
Make the svn_client_cat3 API consistent with the rest of the svn_client
space by not admitting to the existence of entry or WC props.

* subversion/include/svn_client.h (svn_client_cat3):
   Update the docstring to not mention entry props at all.
* subversion/libsvn_client/cat.c (svn_client_cat3):
   Filter entry and WC props from the set that came from the
   RA layer, and always set the output parameter for returned
   properties just before streaming the file contents.

Modified:
    subversion/trunk/subversion/include/svn_client.h
    subversion/trunk/subversion/libsvn_client/cat.c

Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1603501&r1=1603500&r2=1603501&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Wed Jun 18 16:00:29 2014
@@ -5786,9 +5786,9 @@ svn_client_ls(apr_hash_t **dirents,
  *         determined. <br>
  *         If no error occurred, return #SVN_NO_ERROR.
  *
- * If @a *props is not NULL it is set to a hash of all the files properties,
- * including its entry props. If it is NULL, the properties are only used
- * for determining how and if the file should be translated.
+ * If @a *props is not NULL it is set to a hash of all the file's
+ * non-inherited properties. If it is NULL, the properties are only
+ * used for determining how and if the file should be translated.
  *
  * @see #svn_client_ctx_t <br> @ref clnt_revisions for
  *      a discussion of operative and peg revisions.

Modified: subversion/trunk/subversion/libsvn_client/cat.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/cat.c?rev=1603501&r1=1603500&r2=1603501&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/cat.c (original)
+++ subversion/trunk/subversion/libsvn_client/cat.c Wed Jun 18 16:00:29 2014
@@ -176,7 +176,7 @@ svn_client__get_normalized_stream(svn_st
 }
 
 svn_error_t *
-svn_client_cat3(apr_hash_t **props,
+svn_client_cat3(apr_hash_t **returned_props,
                 svn_stream_t *out,
                 const char *path_or_url,
                 const svn_opt_revision_t *peg_revision,
@@ -190,14 +190,11 @@ svn_client_cat3(apr_hash_t **props,
   svn_client__pathrev_t *loc;
   svn_string_t *eol_style;
   svn_string_t *keywords;
-  apr_hash_t *pprops = NULL;
+  apr_hash_t *props = NULL;
   const char *repos_root_url;
   svn_stream_t *output = out;
   svn_error_t *err;
 
-  if (!props)
-    props = &pprops;
-
   /* ### Inconsistent default revision logic in this command. */
   if (peg_revision->kind == svn_opt_revision_unspecified)
     {
@@ -228,8 +225,8 @@ svn_client_cat3(apr_hash_t **props,
       /* We don't promise to close output, so disown it to ensure we don't. */
       output = svn_stream_disown(output, scratch_pool);
 
-      if (props)
-        SVN_ERR(svn_wc_prop_list2(props, ctx->wc_ctx, local_abspath,
+      if (returned_props)
+        SVN_ERR(svn_wc_prop_list2(returned_props, ctx->wc_ctx, local_abspath,
                                   result_pool, scratch_pool));
 
       return svn_error_trace(svn_stream_copy3(normal_stream, output,
@@ -248,7 +245,7 @@ svn_client_cat3(apr_hash_t **props,
 
   /* Grab some properties we need to know in order to figure out if anything
      special needs to be done with this file. */
-  err = svn_ra_get_file(ra_session, "", loc->rev, NULL, NULL, props,
+  err = svn_ra_get_file(ra_session, "", loc->rev, NULL, NULL, &props,
                         result_pool);
   if (err)
     {
@@ -264,8 +261,8 @@ svn_client_cat3(apr_hash_t **props,
         }
     }
 
-  eol_style = svn_hash_gets(*props, SVN_PROP_EOL_STYLE);
-  keywords = svn_hash_gets(*props, SVN_PROP_KEYWORDS);
+  eol_style = svn_hash_gets(props, SVN_PROP_EOL_STYLE);
+  keywords = svn_hash_gets(props, SVN_PROP_KEYWORDS);
 
   if (eol_style || keywords)
     {
@@ -288,9 +285,9 @@ svn_client_cat3(apr_hash_t **props,
           svn_string_t *cmt_rev, *cmt_date, *cmt_author;
           apr_time_t when = 0;
 
-          cmt_rev = svn_hash_gets(*props, SVN_PROP_ENTRY_COMMITTED_REV);
-          cmt_date = svn_hash_gets(*props, SVN_PROP_ENTRY_COMMITTED_DATE);
-          cmt_author = svn_hash_gets(*props, SVN_PROP_ENTRY_LAST_AUTHOR);
+          cmt_rev = svn_hash_gets(props, SVN_PROP_ENTRY_COMMITTED_REV);
+          cmt_date = svn_hash_gets(props, SVN_PROP_ENTRY_COMMITTED_DATE);
+          cmt_author = svn_hash_gets(props, SVN_PROP_ENTRY_LAST_AUTHOR);
           if (cmt_date)
             SVN_ERR(svn_time_from_cstring(&when, cmt_date->data, scratch_pool));
 
@@ -311,6 +308,24 @@ svn_client_cat3(apr_hash_t **props,
                                            scratch_pool);
     }
 
+  if (returned_props)
+    {
+      /* filter entry and WC props */
+      apr_hash_index_t *hi;
+      const void *key;
+      apr_ssize_t klen;
+
+      for (hi = apr_hash_first(scratch_pool, props);
+           hi; hi = apr_hash_next(hi))
+        {
+          apr_hash_this(hi, &key, &klen, NULL);
+          if (!svn_wc_is_normal_prop(key))
+            apr_hash_set(props, key, klen, NULL);
+        }
+
+      *returned_props = props;
+    }
+
   SVN_ERR(svn_ra_get_file(ra_session, "", loc->rev, output, NULL, NULL,
                           scratch_pool));