subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pbu...@apache.org
Subject svn commit: r1416637 - in /subversion/trunk: subversion/include/ subversion/include/private/ subversion/libsvn_ra_local/ subversion/libsvn_repos/ subversion/libsvn_subr/ subversion/mod_dav_svn/reports/ subversion/svn/ subversion/svnlook/ subversion/svn...
Date Mon, 03 Dec 2012 18:52:29 GMT
Author: pburba
Date: Mon Dec  3 18:52:24 2012
New Revision: 1416637

URL: http://svn.apache.org/viewvc?rev=1416637&view=rev
Log:
Add --show-inherited-props support to 'svnlook propget' and
'svnlook proplist' and '--verbose' support to 'svnlook propget'.

The output of these new options now mimics the output of 'svn pl' and
'svn pg' with the same options.  The only change to *existing* 1.7 behavior
is for 'svnlook pl' and 'svnlook pl -v', which now mimics 'svn pl' and
'svn pl -v':

  Old:

    >svnlook pl autoprop_tests-30 /
      svn:auto-props

    >svnlook pl autoprop_tests-30 / -v
      svn:auto-props : *.h=svn:eol-style=native

  New:

    >svnlook pl autoprop_tests-30 /
    Properties on '/':
      svn:auto-props

    >svnlook pl autoprop_tests-30 /  -v
    Properties on '/':
      svn:auto-props
        *.h=svn:eol-style=native

See http://svn.haxx.se/dev/archive-2012-11/0508.shtml and
http://svn.haxx.se/dev/archive-2012-11/0510.shtml

* subversion/include/svn_repos.h

  (svn_repos_fs_get_inherited_props): Add a new argument signaling retrieval
   of only a particular property.

* subversion/libsvn_repos/fs-wrap.c

  (svn_repos_fs_get_inherited_props): Implement new argument.

* subversion/libsvn_ra_local/ra_plugin.c
  (get_node_props):
* subversion/mod_dav_svn/reports/inherited-props.c
  (dav_svn__get_inherited_props_report):
* subversion/svnserve/serve.c
  (get_props):
  Update calls to svn_repos_fs_get_inherited_props() to account for new
  argument.

* subversion/svn/cl.h

  (svn_cl__print_prop_hash,
   svn_cl__print_xml_commit,
   svn_cl__indent_string): Renamed and moved to svn_cmdline_private.h

* subversion/include/private/svn_cmdline_private.h

  (svn_cmdline__indent_string,
   svn_cmdline__print_prop_hash,
   svn_cmdline__print_xml_prop_hash): New.  Moved here from cl.h.

* subversion/svn/props.c

  (svn_cl__print_prop_hash,
   svn_cl__print_xml_prop_hash): Renamed and moved these implementations to
   subversion/libsvn_subr/cmdline.c.

* subversion/svn/util.c

  (next_line,
   svn_cl__indent_string): Renamed and moved these implementations to
   subversion/libsvn_subr/cmdline.c.

* subversion/libsvn_subr/cmdline.c

  (next_line,
   svn_cmdline__indent_string): New.  Renamed and moved here from
   subversion/svn/util.c.

  (svn_cmdline__print_prop_hash,
   svn_cmdline__print_xml_prop_hash): New.  Renamed and moved here from
   subversion/svn/props.c. 

* subversion/svn/log-cmd.c
  (log_entry_receiver_xml):
* subversion/svn/propget-cmd.c
  (print_single_prop):
* subversion/svn/proplist-cmd.c
  (proplist_receiver_xml,
   proplist_receiver,
   svn_cl__proplist):
  Account for svn_cl__* --> svn_cmdline__* renamed functions.

* subversion/svnlook/svnlook.c

  (svnlook__show_inherited_props): New enum for --show-inherited-props
   option.

  (options_table): New help line for --show-inherited-props.

  (cmd_table): Add '-v' and '--show-inherited-props' options to
   'svnlook propget'.  Add '--show-inherited-props' option to
   'svnlook proplist'.

  (svnlook_opt_state): Add member to track --show-inherited-props.

  (stream_write):

  (do_pget): Add new arguments corresponding to the --verbose and
   --show-inherited-props options. 

  (do_plist): Remove comment about returning SVN_ERR_PROPERTY_NOT_FOUND
   if no properties are found, we haven't done that ever for proplist,
   it appears to simply be a copy & paste typo from way back in r845574.
   Add new argument corresponding to the --show-inherited-props option. 

  (subcommand_pget): Update call to do_plist() and do_pget().

  (main): Handle --show-inherited-props.  Raise an error if --revprop and
   --show-inherited-props options are used together.

* subversion/tests/cmdline/svnlook_tests.py

  (output_command): Adjust test expectations to account for change in default
   output of .svnlook pl'.

* tools/client-side/svn-bench/cl.h

  (svn_cl__print_prop_hash): Remove declaration.  No need to rename to
   svn_cmdline__print_prop_hash, as it was no longer referenced in
   tools\client-side\svn-bench.

Modified:
    subversion/trunk/subversion/include/private/svn_cmdline_private.h
    subversion/trunk/subversion/include/svn_repos.h
    subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c
    subversion/trunk/subversion/libsvn_repos/fs-wrap.c
    subversion/trunk/subversion/libsvn_subr/cmdline.c
    subversion/trunk/subversion/mod_dav_svn/reports/inherited-props.c
    subversion/trunk/subversion/svn/cl.h
    subversion/trunk/subversion/svn/log-cmd.c
    subversion/trunk/subversion/svn/propget-cmd.c
    subversion/trunk/subversion/svn/proplist-cmd.c
    subversion/trunk/subversion/svn/props.c
    subversion/trunk/subversion/svn/util.c
    subversion/trunk/subversion/svnlook/svnlook.c
    subversion/trunk/subversion/svnserve/serve.c
    subversion/trunk/subversion/tests/cmdline/svnlook_tests.py
    subversion/trunk/tools/client-side/svn-bench/cl.h

Modified: subversion/trunk/subversion/include/private/svn_cmdline_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_cmdline_private.h?rev=1416637&r1=1416636&r2=1416637&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_cmdline_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_cmdline_private.h Mon Dec  3 18:52:24 2012
@@ -31,6 +31,7 @@
 
 #include "svn_string.h"
 #include "svn_error.h"
+#include "svn_io.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -108,6 +109,40 @@ svn_cmdline__apply_config_options(apr_ha
                                   const char *prefix,
                                   const char *argument_name);
 
+/* Return a string allocated in POOL that is a copy of STR but with each
+ * line prefixed with INDENT. A line is all characters up to the first
+ * CR-LF, LF-CR, CR or LF, or the end of STR if sooner. */
+const char *
+svn_cmdline__indent_string(const char *str,
+                           const char *indent,
+                           apr_pool_t *pool);
+
+/* Print to stdout a hash PROP_HASH that maps property names (char *) to
+   property values (svn_string_t *).  The names are assumed to be in UTF-8
+   format; the values are either in UTF-8 (the special Subversion props) or
+   plain binary values.
+
+   If OUT is not NULL, then write to it rather than stdout.
+
+   If NAMES_ONLY is true, print just names, else print names and
+   values. */
+svn_error_t *
+svn_cmdline__print_prop_hash(svn_stream_t *out,
+                             apr_hash_t *prop_hash,
+                             svn_boolean_t names_only,
+                             apr_pool_t *pool);
+
+/* Similar to svn_cmdline__print_prop_hash(), only output xml to *OUTSTR.
+   If INHERITED_PROPS is true, then PROP_HASH contains inherited properties,
+   otherwise PROP_HASH contains explicit properties.  If *OUTSTR is NULL,
+   allocate it first from POOL, otherwise append to it. */
+svn_error_t *
+svn_cmdline__print_xml_prop_hash(svn_stringbuf_t **outstr,
+                                 apr_hash_t *prop_hash,
+                                 svn_boolean_t names_only,
+                                 svn_boolean_t inherited_props,
+                                 apr_pool_t *pool);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/trunk/subversion/include/svn_repos.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_repos.h?rev=1416637&r1=1416636&r2=1416637&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_repos.h (original)
+++ subversion/trunk/subversion/include/svn_repos.h Mon Dec  3 18:52:24 2012
@@ -3282,6 +3282,9 @@ svn_repos_check_revision_access(svn_repo
  * inherited by @a path in @a root.  If no properties are inherited,
  * then set @a *inherited_values to an empty array.
  *
+ * if @a propname is NULL then retrieve all explicit and/or inherited
+ * properties.  Otherwise retrieve only the properties named @a propname.
+ *
  * If optional @a authz_read_func is non-NULL, then use this function
  * (along with optional @a authz_read_baton) to check the readability
  * of each parent path from which properties are inherited. Silently omit
@@ -3296,6 +3299,7 @@ svn_error_t *
 svn_repos_fs_get_inherited_props(apr_array_header_t **inherited_props,
                                  svn_fs_root_t *root,
                                  const char *path,
+                                 const char *propname,
                                  svn_repos_authz_func_t authz_read_func,
                                  void *authz_read_baton,
                                  apr_pool_t *result_pool,

Modified: subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c?rev=1416637&r1=1416636&r2=1416637&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c Mon Dec  3 18:52:24 2012
@@ -1064,7 +1064,7 @@ get_node_props(apr_hash_t **props,
       int i;
 
       SVN_ERR(svn_repos_fs_get_inherited_props(inherited_props, root, path,
-                                               NULL, NULL,
+                                               NULL, NULL, NULL,
                                                result_pool, scratch_pool));
 
       for (i = 0; i < (*inherited_props)->nelts; i++)

Modified: subversion/trunk/subversion/libsvn_repos/fs-wrap.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/fs-wrap.c?rev=1416637&r1=1416636&r2=1416637&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/fs-wrap.c (original)
+++ subversion/trunk/subversion/libsvn_repos/fs-wrap.c Mon Dec  3 18:52:24 2012
@@ -743,6 +743,7 @@ svn_error_t *
 svn_repos_fs_get_inherited_props(apr_array_header_t **inherited_props_p,
                                  svn_fs_root_t *root,
                                  const char *path,
+                                 const char *propname,
                                  svn_repos_authz_func_t authz_read_func,
                                  void *authz_read_baton,
                                  apr_pool_t *result_pool,
@@ -757,7 +758,7 @@ svn_repos_fs_get_inherited_props(apr_arr
   while (!(parent_path[0] == '/' && parent_path[1] == '\0'))
     {
       svn_boolean_t allowed = TRUE;
-      apr_hash_t *parent_properties;
+      apr_hash_t *parent_properties = NULL;
 
       svn_pool_clear(iterpool);
       parent_path = svn_fspath__dirname(parent_path, scratch_pool);
@@ -767,8 +768,25 @@ svn_repos_fs_get_inherited_props(apr_arr
                                 authz_read_baton, iterpool));
       if (allowed)
         {
-          SVN_ERR(svn_fs_node_proplist(&parent_properties, root,
-                                       parent_path, result_pool));
+          if (propname)
+            {
+              svn_string_t *propval;
+
+              SVN_ERR(svn_fs_node_prop(&propval, root, parent_path, propname,
+                                       result_pool));
+              if (propval)
+                {
+                  parent_properties = apr_hash_make(result_pool);
+                  apr_hash_set(parent_properties, propname,
+                               APR_HASH_KEY_STRING, propval);
+                }
+            }
+          else
+            {
+              SVN_ERR(svn_fs_node_proplist(&parent_properties, root,
+                                           parent_path, result_pool));
+            }
+
           if (parent_properties && apr_hash_count(parent_properties))
             {
               svn_prop_inherited_item_t *i_props =

Modified: subversion/trunk/subversion/libsvn_subr/cmdline.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/cmdline.c?rev=1416637&r1=1416636&r2=1416637&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/cmdline.c (original)
+++ subversion/trunk/subversion/libsvn_subr/cmdline.c Mon Dec  3 18:52:24 2012
@@ -52,6 +52,9 @@
 #include "svn_xml.h"
 #include "svn_base64.h"
 #include "svn_config.h"
+#include "svn_sorts.h"
+#include "svn_props.h"
+#include "svn_subst.h"
 
 #include "private/svn_cmdline_private.h"
 #include "private/svn_utf_private.h"
@@ -758,3 +761,165 @@ svn_cmdline__apply_config_options(apr_ha
 
   return SVN_NO_ERROR;
 }
+
+/* Return a copy, allocated in POOL, of the next line of text from *STR
+ * up to and including a CR and/or an LF. Change *STR to point to the
+ * remainder of the string after the returned part. If there are no
+ * characters to be returned, return NULL; never return an empty string.
+ */
+static const char *
+next_line(const char **str, apr_pool_t *pool)
+{
+  const char *start = *str;
+  const char *p = *str;
+
+  /* n.b. Throughout this fn, we never read any character after a '\0'. */
+  /* Skip over all non-EOL characters, if any. */
+  while (*p != '\r' && *p != '\n' && *p != '\0')
+    p++;
+  /* Skip over \r\n or \n\r or \r or \n, if any. */
+  if (*p == '\r' || *p == '\n')
+    {
+      char c = *p++;
+
+      if ((c == '\r' && *p == '\n') || (c == '\n' && *p == '\r'))
+        p++;
+    }
+
+  /* Now p points after at most one '\n' and/or '\r'. */
+  *str = p;
+
+  if (p == start)
+    return NULL;
+
+  return svn_string_ncreate(start, p - start, pool)->data;
+}
+
+const char *
+svn_cmdline__indent_string(const char *str,
+                           const char *indent,
+                           apr_pool_t *pool)
+{
+  svn_stringbuf_t *out = svn_stringbuf_create_empty(pool);
+  const char *line;
+
+  while ((line = next_line(&str, pool)))
+    {
+      svn_stringbuf_appendcstr(out, indent);
+      svn_stringbuf_appendcstr(out, line);
+    }
+  return out->data;
+}
+
+svn_error_t *
+svn_cmdline__print_prop_hash(svn_stream_t *out,
+                             apr_hash_t *prop_hash,
+                             svn_boolean_t names_only,
+                             apr_pool_t *pool)
+{
+  apr_array_header_t *sorted_props;
+  int i;
+
+  sorted_props = svn_sort__hash(prop_hash, svn_sort_compare_items_lexically,
+                                pool);
+  for (i = 0; i < sorted_props->nelts; i++)
+    {
+      svn_sort__item_t item = APR_ARRAY_IDX(sorted_props, i, svn_sort__item_t);
+      const char *pname = item.key;
+      svn_string_t *propval = item.value;
+      const char *pname_stdout;
+
+      if (svn_prop_needs_translation(pname))
+        SVN_ERR(svn_subst_detranslate_string(&propval, propval,
+                                             TRUE, pool));
+
+      SVN_ERR(svn_cmdline_cstring_from_utf8(&pname_stdout, pname, pool));
+
+      if (out)
+        {
+          pname_stdout = apr_psprintf(pool, "  %s\n", pname_stdout);
+          SVN_ERR(svn_subst_translate_cstring2(pname_stdout, &pname_stdout,
+                                              APR_EOL_STR,  /* 'native' eol */
+                                              FALSE, /* no repair */
+                                              NULL,  /* no keywords */
+                                              FALSE, /* no expansion */
+                                              pool));
+
+          SVN_ERR(svn_stream_puts(out, pname_stdout));
+        }
+      else
+        {
+          /* ### We leave these printfs for now, since if propval wasn't
+             translated above, we don't know anything about its encoding.
+             In fact, it might be binary data... */
+          printf("  %s\n", pname_stdout);
+        }
+
+      if (!names_only)
+        {
+          /* Add an extra newline to the value before indenting, so that
+           * every line of output has the indentation whether the value
+           * already ended in a newline or not. */
+          const char *newval = apr_psprintf(pool, "%s\n", propval->data);
+          const char *indented_newval = svn_cmdline__indent_string(newval,
+                                                                   "    ",
+                                                                   pool);
+          if (out)
+            {
+              SVN_ERR(svn_stream_puts(out, indented_newval));
+            }
+          else
+            {
+              printf("%s", indented_newval);
+            }
+        }
+    }
+
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_cmdline__print_xml_prop_hash(svn_stringbuf_t **outstr,
+                                 apr_hash_t *prop_hash,
+                                 svn_boolean_t names_only,
+                                 svn_boolean_t inherited_props,
+                                 apr_pool_t *pool)
+{
+  apr_array_header_t *sorted_props;
+  int i;
+
+  if (*outstr == NULL)
+    *outstr = svn_stringbuf_create_empty(pool);
+
+  sorted_props = svn_sort__hash(prop_hash, svn_sort_compare_items_lexically,
+                                pool);
+  for (i = 0; i < sorted_props->nelts; i++)
+    {
+      svn_sort__item_t item = APR_ARRAY_IDX(sorted_props, i, svn_sort__item_t);
+      const char *pname = item.key;
+      svn_string_t *propval = item.value;
+
+      if (names_only)
+        {
+          svn_xml_make_open_tag(
+            outstr, pool, svn_xml_self_closing,
+            inherited_props ? "inherited_property" : "property",
+            "name", pname, NULL);
+        }
+      else
+        {
+          const char *pname_out;
+
+          if (svn_prop_needs_translation(pname))
+            SVN_ERR(svn_subst_detranslate_string(&propval, propval,
+                                                 TRUE, pool));
+
+          SVN_ERR(svn_cmdline_cstring_from_utf8(&pname_out, pname, pool));
+
+          svn_cmdline__print_xml_prop(outstr, pname_out, propval,
+                                      inherited_props, pool);
+        }
+    }
+
+    return SVN_NO_ERROR;
+}

Modified: subversion/trunk/subversion/mod_dav_svn/reports/inherited-props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/inherited-props.c?rev=1416637&r1=1416636&r2=1416637&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/reports/inherited-props.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/reports/inherited-props.c Mon Dec  3 18:52:24 2012
@@ -113,7 +113,7 @@ dav_svn__get_inherited_props_report(cons
                                 "couldn't retrieve revision root",
                                 resource->pool);
 
-  serr = svn_repos_fs_get_inherited_props(&inherited_props, root, path,
+  serr = svn_repos_fs_get_inherited_props(&inherited_props, root, path, NULL,
                                           dav_svn__authz_read_func(&arb),
                                           &arb, resource->pool, iterpool);
   if (serr)

Modified: subversion/trunk/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cl.h?rev=1416637&r1=1416636&r2=1416637&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/cl.h (original)
+++ subversion/trunk/subversion/svn/cl.h Mon Dec  3 18:52:24 2012
@@ -462,33 +462,6 @@ svn_cl__print_status_xml(const char *cwd
                          svn_client_ctx_t *ctx,
                          apr_pool_t *pool);
 
-
-/* Print to stdout a hash that maps property names (char *) to property
-   values (svn_string_t *).  The names are assumed to be in UTF-8 format;
-   the values are either in UTF-8 (the special Subversion props) or
-   plain binary values.
-
-   If OUT is not NULL, then write to it rather than stdout.
-
-   If NAMES_ONLY is true, print just names, else print names and
-   values. */
-svn_error_t *
-svn_cl__print_prop_hash(svn_stream_t *out,
-                        apr_hash_t *prop_hash,
-                        svn_boolean_t names_only,
-                        apr_pool_t *pool);
-
-/* Similar to svn_cl__print_prop_hash(), only output xml to *OUTSTR.
-   If INHERITED_PROPS is true, then PROP_HASH contains inherited properties,
-   otherwise PROP_HASH contains explicit properties.  If *OUTSTR is NULL,
-   allocate it first from POOL, otherwise append to it. */
-svn_error_t *
-svn_cl__print_xml_prop_hash(svn_stringbuf_t **outstr,
-                            apr_hash_t *prop_hash,
-                            svn_boolean_t names_only,
-                            svn_boolean_t inherited_props,
-                            apr_pool_t *pool);
-
 /* Output a commit xml element to *OUTSTR.  If *OUTSTR is NULL, allocate it
    first from POOL, otherwise append to it.  If AUTHOR or DATE is
    NULL, it will be omitted. */
@@ -820,15 +793,6 @@ svn_cl__args_to_target_array_print_reser
                                             svn_boolean_t keep_dest_origpath_on_truepath_collision,
                                             apr_pool_t *pool);
 
-/* Return a string allocated in POOL that is a copy of STR but with each
- * line prefixed with INDENT. A line is all characters up to the first
- * CR-LF, LF-CR, CR or LF, or the end of STR if sooner. */
-const char *
-svn_cl__indent_string(const char *str,
-                      const char *indent,
-                      apr_pool_t *pool);
-
-
 /* Return a string showing NODE's kind, URL and revision, to the extent that
  * that information is available in NODE. If NODE itself is NULL, this prints
  * just a 'none' node kind.

Modified: subversion/trunk/subversion/svn/log-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/log-cmd.c?rev=1416637&r1=1416636&r2=1416637&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/log-cmd.c (original)
+++ subversion/trunk/subversion/svn/log-cmd.c Mon Dec  3 18:52:24 2012
@@ -39,6 +39,8 @@
 #include "svn_props.h"
 #include "svn_pools.h"
 
+#include "private/svn_cmdline_private.h"
+
 #include "cl.h"
 
 #include "svn_private_config.h"
@@ -653,9 +655,9 @@ log_entry_receiver_xml(void *baton,
   if (log_entry->revprops && apr_hash_count(log_entry->revprops) > 0)
     {
       svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "revprops", NULL);
-      SVN_ERR(svn_cl__print_xml_prop_hash(&sb, log_entry->revprops,
-                                          FALSE, /* name_only */
-                                          FALSE, pool));
+      SVN_ERR(svn_cmdline__print_xml_prop_hash(&sb, log_entry->revprops,
+                                               FALSE, /* name_only */
+                                               FALSE, pool));
       svn_xml_make_close_tag(&sb, pool, "revprops");
     }
 

Modified: subversion/trunk/subversion/svn/propget-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/propget-cmd.c?rev=1416637&r1=1416636&r2=1416637&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/propget-cmd.c (original)
+++ subversion/trunk/subversion/svn/propget-cmd.c Mon Dec  3 18:52:24 2012
@@ -210,7 +210,7 @@ print_single_prop(svn_string_t *propval,
       apr_hash_t *hash = apr_hash_make(scratch_pool);
 
       apr_hash_set(hash, pname_utf8, APR_HASH_KEY_STRING, propval);
-      SVN_ERR(svn_cl__print_prop_hash(out, hash, FALSE, scratch_pool));
+      SVN_ERR(svn_cmdline__print_prop_hash(out, hash, FALSE, scratch_pool));
     }
   else
     {

Modified: subversion/trunk/subversion/svn/proplist-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/proplist-cmd.c?rev=1416637&r1=1416636&r2=1416637&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/proplist-cmd.c (original)
+++ subversion/trunk/subversion/svn/proplist-cmd.c Mon Dec  3 18:52:24 2012
@@ -38,6 +38,8 @@
 #include "svn_props.h"
 #include "cl.h"
 
+#include "private/svn_cmdline_private.h"
+
 #include "svn_private_config.h"
 
 typedef struct proplist_baton_t
@@ -82,9 +84,9 @@ proplist_receiver_xml(void *baton,
 
           svn_xml_make_open_tag(&sb, iterpool, svn_xml_normal, "target",
                             "path", name_local, NULL);
-          SVN_ERR(svn_cl__print_xml_prop_hash(&sb, iprop->prop_hash,
-                                              (! opt_state->verbose),
-                                              TRUE, iterpool));
+          SVN_ERR(svn_cmdline__print_xml_prop_hash(&sb, iprop->prop_hash,
+                                                   (! opt_state->verbose),
+                                                   TRUE, iterpool));
           svn_xml_make_close_tag(&sb, iterpool, "target");
           SVN_ERR(svn_cl__error_checked_fputs(sb->data, stdout));
         }
@@ -105,9 +107,9 @@ proplist_receiver_xml(void *baton,
         svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "target",
                               "path", name_local, NULL);
 
-        SVN_ERR(svn_cl__print_xml_prop_hash(&sb, prop_hash,
-                                            (! opt_state->verbose),
-                                            FALSE, pool));
+        SVN_ERR(svn_cmdline__print_xml_prop_hash(&sb, prop_hash,
+                                                 (! opt_state->verbose),
+                                                 FALSE, pool));
 
         /* "</target>" */
         svn_xml_make_close_tag(&sb, pool, "target");
@@ -160,8 +162,9 @@ proplist_receiver(void *baton,
                                                      iterpool)));
             }
 
-          SVN_ERR(svn_cl__print_prop_hash(NULL, iprop->prop_hash,
-                                          (! opt_state->verbose), iterpool));
+          SVN_ERR(svn_cmdline__print_prop_hash(NULL, iprop->prop_hash,
+                                               (! opt_state->verbose),
+                                               iterpool));
         }
       svn_pool_destroy(iterpool);
     }
@@ -171,8 +174,8 @@ proplist_receiver(void *baton,
       if (!opt_state->quiet)
         SVN_ERR(svn_cmdline_printf(pool, _("Properties on '%s':\n"),
                                    name_local));
-      SVN_ERR(svn_cl__print_prop_hash(NULL, prop_hash, (! opt_state->verbose),
-                                      pool));
+      SVN_ERR(svn_cmdline__print_prop_hash(NULL, prop_hash,
+                                           (! opt_state->verbose), pool));
     }
 
   return SVN_NO_ERROR;
@@ -228,9 +231,9 @@ svn_cl__proplist(apr_getopt_t *os,
           svn_xml_make_open_tag(&sb, scratch_pool, svn_xml_normal,
                                 "revprops",
                                 "rev", revstr, NULL);
-          SVN_ERR(svn_cl__print_xml_prop_hash(&sb, proplist,
-                                              (! opt_state->verbose), FALSE,
-                                              scratch_pool));
+          SVN_ERR(svn_cmdline__print_xml_prop_hash(&sb, proplist,
+                                                   (! opt_state->verbose),
+                                                   FALSE, scratch_pool));
           svn_xml_make_close_tag(&sb, scratch_pool, "revprops");
 
           SVN_ERR(svn_cl__error_checked_fputs(sb->data, stdout));
@@ -243,8 +246,9 @@ svn_cl__proplist(apr_getopt_t *os,
                                 _("Unversioned properties on revision %ld:\n"),
                                 rev));
 
-          SVN_ERR(svn_cl__print_prop_hash
-                  (NULL, proplist, (! opt_state->verbose), scratch_pool));
+          SVN_ERR(svn_cmdline__print_prop_hash(NULL, proplist,
+                                               (! opt_state->verbose),
+                                               scratch_pool));
         }
     }
   else  /* operate on normal, versioned properties (not revprops) */

Modified: subversion/trunk/subversion/svn/props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/props.c?rev=1416637&r1=1416636&r2=1416637&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/props.c (original)
+++ subversion/trunk/subversion/svn/props.c Mon Dec  3 18:52:24 2012
@@ -83,121 +83,6 @@ svn_cl__revprop_prepare(const svn_opt_re
   return SVN_NO_ERROR;
 }
 
-
-svn_error_t *
-svn_cl__print_prop_hash(svn_stream_t *out,
-                        apr_hash_t *prop_hash,
-                        svn_boolean_t names_only,
-                        apr_pool_t *pool)
-{
-  apr_array_header_t *sorted_props;
-  int i;
-
-  sorted_props = svn_sort__hash(prop_hash, svn_sort_compare_items_lexically,
-                                pool);
-  for (i = 0; i < sorted_props->nelts; i++)
-    {
-      svn_sort__item_t item = APR_ARRAY_IDX(sorted_props, i, svn_sort__item_t);
-      const char *pname = item.key;
-      svn_string_t *propval = item.value;
-      const char *pname_stdout;
-
-      if (svn_prop_needs_translation(pname))
-        SVN_ERR(svn_subst_detranslate_string(&propval, propval,
-                                             TRUE, pool));
-
-      SVN_ERR(svn_cmdline_cstring_from_utf8(&pname_stdout, pname, pool));
-
-      if (out)
-        {
-          pname_stdout = apr_psprintf(pool, "  %s\n", pname_stdout);
-          SVN_ERR(svn_subst_translate_cstring2(pname_stdout, &pname_stdout,
-                                              APR_EOL_STR,  /* 'native' eol */
-                                              FALSE, /* no repair */
-                                              NULL,  /* no keywords */
-                                              FALSE, /* no expansion */
-                                              pool));
-
-          SVN_ERR(svn_stream_puts(out, pname_stdout));
-        }
-      else
-        {
-          /* ### We leave these printfs for now, since if propval wasn't
-             translated above, we don't know anything about its encoding.
-             In fact, it might be binary data... */
-          printf("  %s\n", pname_stdout);
-        }
-
-      if (!names_only)
-        {
-          /* Add an extra newline to the value before indenting, so that
-           * every line of output has the indentation whether the value
-           * already ended in a newline or not. */
-          const char *newval = apr_psprintf(pool, "%s\n", propval->data);
-          const char *indented_newval = svn_cl__indent_string(newval,
-                                                              "    ",
-                                                              pool);
-          if (out)
-            {
-              SVN_ERR(svn_stream_puts(out, indented_newval));
-            }
-          else
-            {
-              printf("%s", indented_newval);
-            }
-        }
-    }
-
-  return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_cl__print_xml_prop_hash(svn_stringbuf_t **outstr,
-                            apr_hash_t *prop_hash,
-                            svn_boolean_t names_only,
-                            svn_boolean_t inherited_props,
-                            apr_pool_t *pool)
-{
-  apr_array_header_t *sorted_props;
-  int i;
-
-  if (*outstr == NULL)
-    *outstr = svn_stringbuf_create_empty(pool);
-
-  sorted_props = svn_sort__hash(prop_hash, svn_sort_compare_items_lexically,
-                                pool);
-  for (i = 0; i < sorted_props->nelts; i++)
-    {
-      svn_sort__item_t item = APR_ARRAY_IDX(sorted_props, i, svn_sort__item_t);
-      const char *pname = item.key;
-      svn_string_t *propval = item.value;
-
-      if (names_only)
-        {
-          svn_xml_make_open_tag(
-            outstr, pool, svn_xml_self_closing,
-            inherited_props ? "inherited_property" : "property",
-            "name", pname, NULL);
-        }
-      else
-        {
-          const char *pname_out;
-
-          if (svn_prop_needs_translation(pname))
-            SVN_ERR(svn_subst_detranslate_string(&propval, propval,
-                                                 TRUE, pool));
-
-          SVN_ERR(svn_cmdline_cstring_from_utf8(&pname_out, pname, pool));
-
-          svn_cmdline__print_xml_prop(outstr, pname_out, propval,
-                                      inherited_props, pool);
-        }
-    }
-
-    return SVN_NO_ERROR;
-}
-
-
 void
 svn_cl__check_boolean_prop_val(const char *propname, const char *propval,
                                apr_pool_t *pool)

Modified: subversion/trunk/subversion/svn/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/util.c?rev=1416637&r1=1416636&r2=1416637&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/util.c (original)
+++ subversion/trunk/subversion/svn/util.c Mon Dec  3 18:52:24 2012
@@ -1264,56 +1264,6 @@ svn_cl__time_cstring_to_human_cstring(co
   return SVN_NO_ERROR;
 }
 
-
-/* Return a copy, allocated in POOL, of the next line of text from *STR
- * up to and including a CR and/or an LF. Change *STR to point to the
- * remainder of the string after the returned part. If there are no
- * characters to be returned, return NULL; never return an empty string.
- */
-static const char *
-next_line(const char **str, apr_pool_t *pool)
-{
-  const char *start = *str;
-  const char *p = *str;
-
-  /* n.b. Throughout this fn, we never read any character after a '\0'. */
-  /* Skip over all non-EOL characters, if any. */
-  while (*p != '\r' && *p != '\n' && *p != '\0')
-    p++;
-  /* Skip over \r\n or \n\r or \r or \n, if any. */
-  if (*p == '\r' || *p == '\n')
-    {
-      char c = *p++;
-
-      if ((c == '\r' && *p == '\n') || (c == '\n' && *p == '\r'))
-        p++;
-    }
-
-  /* Now p points after at most one '\n' and/or '\r'. */
-  *str = p;
-
-  if (p == start)
-    return NULL;
-
-  return svn_string_ncreate(start, p - start, pool)->data;
-}
-
-const char *
-svn_cl__indent_string(const char *str,
-                      const char *indent,
-                      apr_pool_t *pool)
-{
-  svn_stringbuf_t *out = svn_stringbuf_create_empty(pool);
-  const char *line;
-
-  while ((line = next_line(&str, pool)))
-    {
-      svn_stringbuf_appendcstr(out, indent);
-      svn_stringbuf_appendcstr(out, line);
-    }
-  return out->data;
-}
-
 const char *
 svn_cl__node_description(const svn_wc_conflict_version_t *node,
                          const char *wc_repos_root_URL,

Modified: subversion/trunk/subversion/svnlook/svnlook.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnlook/svnlook.c?rev=1416637&r1=1416636&r2=1416637&view=diff
==============================================================================
--- subversion/trunk/subversion/svnlook/svnlook.c (original)
+++ subversion/trunk/subversion/svnlook/svnlook.c Mon Dec  3 18:52:24 2012
@@ -97,7 +97,8 @@ enum
     svnlook__xml_opt,
     svnlook__ignore_properties,
     svnlook__properties_only,
-    svnlook__diff_cmd
+    svnlook__diff_cmd,
+    svnlook__show_inherited_props
   };
 
 /*
@@ -150,6 +151,9 @@ static const apr_getopt_option_t options
   {"show-ids",          svnlook__show_ids, 0,
    N_("show node revision ids for each path")},
 
+  {"show-inherited-props", svnlook__show_inherited_props, 0,
+   N_("show path's inherited properties")},
+
   {"transaction",       't', 1,
    N_("specify transaction name ARG")},
 
@@ -265,7 +269,7 @@ static const svn_opt_subcommand_desc2_t 
       "       2. svnlook propget --revprop REPOS_PATH PROPNAME\n\n"
       "Print the raw value of a property on a path in the repository.\n"
       "With --revprop, print the raw value of a revision property.\n"),
-   {'r', 't', svnlook__revprop_opt} },
+   {'r', 't', 'v', svnlook__revprop_opt, svnlook__show_inherited_props} },
 
   {"proplist", subcommand_plist, {"plist", "pl"},
    N_("usage: 1. svnlook proplist REPOS_PATH PATH_IN_REPOS\n"
@@ -275,7 +279,8 @@ static const svn_opt_subcommand_desc2_t 
       "List the properties of a path in the repository, or\n"
       "with the --revprop option, revision properties.\n"
       "With -v, show the property values too.\n"),
-   {'r', 't', 'v', svnlook__revprop_opt, svnlook__xml_opt} },
+   {'r', 't', 'v', svnlook__revprop_opt, svnlook__xml_opt,
+    svnlook__show_inherited_props} },
 
   {"tree", subcommand_tree, {0},
    N_("usage: svnlook tree REPOS_PATH [PATH_IN_REPOS]\n\n"
@@ -323,6 +328,7 @@ struct svnlook_opt_state
   svn_boolean_t ignore_properties;  /* --ignore_properties */
   svn_boolean_t properties_only;    /* --properties-only */
   const char *diff_cmd;           /* --diff-cmd */
+  svn_boolean_t show_inherited_props; /*  --show-inherited-props */
 };
 
 
@@ -1628,13 +1634,23 @@ do_history(svnlook_ctxt_t *c,
 
 
 /* Print the value of property PROPNAME on PATH in the repository.
-   Error with SVN_ERR_FS_NOT_FOUND if PATH does not exist, or with
-   SVN_ERR_PROPERTY_NOT_FOUND if no such property on PATH.
+
+   If VERBOSE, print their values too.  If SHOW_INHERITED_PROPS, print
+   PATH's inherited props too.
+
+   Error with SVN_ERR_FS_NOT_FOUND if PATH does not exist. If
+   SHOW_INHERITED_PROPS is FALSE,then error with SVN_ERR_PROPERTY_NOT_FOUND
+   if there is no such property on PATH.  If SHOW_INHERITED_PROPS is TRUE,
+   then error with SVN_ERR_PROPERTY_NOT_FOUND only if there is no such
+   property on PATH nor inherited by path.
+
    If PATH is NULL, operate on a revision property. */
 static svn_error_t *
 do_pget(svnlook_ctxt_t *c,
         const char *propname,
         const char *path,
+        svn_boolean_t verbose,
+        svn_boolean_t show_inherited_props,
         apr_pool_t *pool)
 {
   svn_fs_root_t *root;
@@ -1642,17 +1658,30 @@ do_pget(svnlook_ctxt_t *c,
   svn_node_kind_t kind;
   svn_stream_t *stdout_stream;
   apr_size_t len;
+  apr_array_header_t *inherited_props = NULL;
 
   SVN_ERR(get_root(&root, c, pool));
   if (path != NULL)
     {
+      path = svn_fspath__canonicalize(path, pool);
       SVN_ERR(verify_path(&kind, root, path, pool));
       SVN_ERR(svn_fs_node_prop(&prop, root, path, propname, pool));
+
+      if (show_inherited_props)
+        {
+          SVN_ERR(svn_repos_fs_get_inherited_props(&inherited_props, root,
+                                                   path, propname, NULL,
+                                                   NULL, pool, pool));
+        }
+    }
+  else /* --revprop */
+    {
+      SVN_ERR(get_property(&prop, c, propname, pool));
     }
-  else
-    SVN_ERR(get_property(&prop, c, propname, pool));
 
-  if (prop == NULL)
+  /* Did we find nothing? */
+  if (prop == NULL
+      && (!show_inherited_props || inherited_props->nelts == 0))
     {
        const char *err_msg;
        if (path == NULL)
@@ -1665,61 +1694,162 @@ do_pget(svnlook_ctxt_t *c,
        else
          {
            if (SVN_IS_VALID_REVNUM(c->rev_id))
-             err_msg = apr_psprintf(pool,
-                                    _("Property '%s' not found on path '%s' "
-                                      "in revision %ld"),
-                                    propname, path, c->rev_id);
+             {
+               if (show_inherited_props)
+                 err_msg = apr_psprintf(pool,
+                                        _("Property '%s' not found on path '%s' "
+                                          "or inherited from a parent "
+                                          "in revision %ld"),
+                                        propname, path, c->rev_id);
+               else
+                 err_msg = apr_psprintf(pool,
+                                        _("Property '%s' not found on path '%s' "
+                                          "in revision %ld"),
+                                        propname, path, c->rev_id);
+             }
            else
-             err_msg = apr_psprintf(pool,
-                                    _("Property '%s' not found on path '%s' "
-                                      "in transaction %s"),
-                                    propname, path, c->txn_name);
+             {
+               if (show_inherited_props)
+                 err_msg = apr_psprintf(pool,
+                                        _("Property '%s' not found on path '%s' "
+                                          "or inherited from a parent "
+                                          "in transaction %s"),
+                                        propname, path, c->txn_name);
+               else
+                 err_msg = apr_psprintf(pool,
+                                        _("Property '%s' not found on path '%s' "
+                                          "in transaction %s"),
+                                        propname, path, c->txn_name);
+             }
          }
        return svn_error_create(SVN_ERR_PROPERTY_NOT_FOUND, NULL, err_msg);
     }
 
-  /* Else. */
-
   SVN_ERR(svn_stream_for_stdout(&stdout_stream, pool));
 
-  /* Unlike the command line client, we don't translate the property
-     value or print a trailing newline here.  We just output the raw
-     bytes of whatever's in the repository, as svnlook is more likely
-     to be used for automated inspections. */
-  len = prop->len;
-  SVN_ERR(svn_stream_write(stdout_stream, prop->data, &len));
+  if (verbose || show_inherited_props)
+    {
+      if (inherited_props)
+        {
+          int i;
+
+          for (i = 0; i < inherited_props->nelts; i++)
+            {
+              svn_prop_inherited_item_t *elt =
+                APR_ARRAY_IDX(inherited_props, i,
+                              svn_prop_inherited_item_t *);
+
+              if (verbose)
+                {
+                  SVN_ERR(svn_stream_printf(stdout_stream, pool,
+                          _("Inherited properties on '%s',\nfrom '%s':\n"),
+                          path, svn_fspath__canonicalize(elt->path_or_url,
+                                                         pool)));
+                  SVN_ERR(svn_cmdline__print_prop_hash(stdout_stream,
+                                                       elt->prop_hash,
+                                                       !verbose, pool));
+                }
+              else
+                {
+                  svn_string_t *propval =
+                    svn__apr_hash_index_val(apr_hash_first(pool,
+                                                           elt->prop_hash));
+
+                  SVN_ERR(svn_stream_printf(
+                    stdout_stream, pool, "%s - ",
+                    svn_fspath__canonicalize(elt->path_or_url, pool)));
+                  len = propval->len;
+                  SVN_ERR(svn_stream_write(stdout_stream, propval->data, &len));
+                  /* If we have more than one property to write, then add a newline*/
+                  if (inherited_props->nelts > 1 || prop)
+                    {
+                      len = strlen(APR_EOL_STR);
+                      SVN_ERR(svn_stream_write(stdout_stream, APR_EOL_STR, &len));
+                    }
+                }
+            }
+        }
+
+      if (prop)
+        {
+          if (verbose)
+            {
+              apr_hash_t *hash = apr_hash_make(pool);
+
+              apr_hash_set(hash, propname, APR_HASH_KEY_STRING, prop);
+              SVN_ERR(svn_stream_printf(stdout_stream, pool,
+                      _("Properties on '%s':\n"), path));
+              SVN_ERR(svn_cmdline__print_prop_hash(stdout_stream, hash,
+                                                   FALSE, pool));
+            }
+          else
+            {
+              SVN_ERR(svn_stream_printf(stdout_stream, pool, "%s - ", path));
+              len = prop->len;
+              SVN_ERR(svn_stream_write(stdout_stream, prop->data, &len));
+            }
+        }
+    }
+  else /* Raw single prop output, i.e. non-verbose output with no
+          inherited props. */
+    {
+      /* Unlike the command line client, we don't translate the property
+         value or print a trailing newline here.  We just output the raw
+         bytes of whatever's in the repository, as svnlook is more likely
+         to be used for automated inspections. */
+      len = prop->len;
+      SVN_ERR(svn_stream_write(stdout_stream, prop->data, &len));
+    }
 
   return SVN_NO_ERROR;
 }
 
 
 /* Print the property names of all properties on PATH in the repository.
-   If VERBOSE, print their values too.
-   If XML, print as XML rather than as plain text.
-   Error with SVN_ERR_FS_NOT_FOUND if PATH does not exist, or with
-   SVN_ERR_PROPERTY_NOT_FOUND if no such property on PATH.
+
+   If VERBOSE, print their values too.  If XML, print as XML rather than as
+   plain text.  If SHOW_INHERITED_PROPS, print PATH's inherited props too.
+
+   Error with SVN_ERR_FS_NOT_FOUND if PATH does not exist.
+
    If PATH is NULL, operate on a revision properties. */
 static svn_error_t *
 do_plist(svnlook_ctxt_t *c,
          const char *path,
          svn_boolean_t verbose,
          svn_boolean_t xml,
+         svn_boolean_t show_inherited_props,
          apr_pool_t *pool)
 {
-  svn_stream_t *stdout_stream;
   svn_fs_root_t *root;
   apr_hash_t *props;
   apr_hash_index_t *hi;
   svn_node_kind_t kind;
   svn_stringbuf_t *sb = NULL;
   svn_boolean_t revprop = FALSE;
+  apr_array_header_t *inherited_props = NULL;
 
-  SVN_ERR(svn_stream_for_stdout(&stdout_stream, pool));
   if (path != NULL)
     {
+      /* PATH might be the root of the repsository and we accept both
+         "" and "/".  But to avoid the somewhat cryptic output like this:
+
+           >svnlook pl repos-path ""
+           Properties on '':
+             svn:auto-props
+             svn:global-ignores
+
+         We canonicalize PATH so that is has a leading slash. */
+      path = svn_fspath__canonicalize(path, pool);
+
       SVN_ERR(get_root(&root, c, pool));
       SVN_ERR(verify_path(&kind, root, path, pool));
       SVN_ERR(svn_fs_node_proplist(&props, root, path, pool));
+
+      if (show_inherited_props)
+        SVN_ERR(svn_repos_fs_get_inherited_props(&inherited_props, root,
+                                                 path, NULL, NULL, NULL,
+                                                 pool, pool));
     }
   else if (c->is_revision)
     {
@@ -1734,18 +1864,55 @@ do_plist(svnlook_ctxt_t *c,
 
   if (xml)
     {
-      char *revstr = apr_psprintf(pool, "%ld", c->rev_id);
       /* <?xml version="1.0" encoding="UTF-8"?> */
       svn_xml_make_header2(&sb, "UTF-8", pool);
 
       /* "<properties>" */
       svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "properties", NULL);
+    }
 
+  if (inherited_props)
+    {
+      int i;
+
+      for (i = 0; i < inherited_props->nelts; i++)
+        {
+          svn_prop_inherited_item_t *elt =
+            APR_ARRAY_IDX(inherited_props, i, svn_prop_inherited_item_t *);
+
+          /* Canonicalize the inherited parent paths for consistency
+             with PATH. */
+          if (xml)
+            {
+              svn_xml_make_open_tag(
+                &sb, pool, svn_xml_normal, "target", "path",
+                svn_fspath__canonicalize(elt->path_or_url, pool),
+                NULL);
+              SVN_ERR(svn_cmdline__print_xml_prop_hash(&sb, elt->prop_hash,
+                                                       !verbose, TRUE,
+                                                       pool));
+              svn_xml_make_close_tag(&sb, pool, "target");
+            }
+          else
+            {
+              SVN_ERR(svn_cmdline_printf(
+                pool, _("Inherited properties on '%s',\nfrom '%s':\n"),
+                path, svn_fspath__canonicalize(elt->path_or_url, pool)));
+               SVN_ERR(svn_cmdline__print_prop_hash(NULL, elt->prop_hash,
+                                                    !verbose, pool));
+            }
+        }
+    }
+
+  if (xml)
+    {
       if (revprop)
         {
           /* "<revprops ...>" */
           if (c->is_revision)
             {
+              char *revstr = apr_psprintf(pool, "%ld", c->rev_id);
+
               svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "revprops",
                                     "rev", revstr, NULL);
             }
@@ -1763,6 +1930,9 @@ do_plist(svnlook_ctxt_t *c,
         }
     }
 
+  if (!xml && path /* Not a --revprop */)
+    SVN_ERR(svn_cmdline_printf(pool, _("Properties on '%s':\n"), path));
+
   for (hi = apr_hash_first(pool, props); hi; hi = apr_hash_next(hi))
     {
       const char *pname = svn__apr_hash_index_key(hi);
@@ -1786,10 +1956,19 @@ do_plist(svnlook_ctxt_t *c,
           else
             {
               const char *pname_stdout;
+              const char *indented_newval;
 
               SVN_ERR(svn_cmdline_cstring_from_utf8(&pname_stdout, pname,
                                                     pool));
-              printf("  %s : %s\n", pname_stdout, propval->data);
+              printf("  %s\n", pname_stdout);
+              /* Add an extra newline to the value before indenting, so that
+                 every line of output has the indentation whether the value
+                 already ended in a newline or not. */
+              indented_newval =
+                svn_cmdline__indent_string(apr_psprintf(pool, "%s\n",
+                                                        propval->data),
+                                           "    ", pool);
+              printf("%s", indented_newval);
             }
         }
       else if (xml)
@@ -2171,7 +2350,9 @@ subcommand_pget(apr_getopt_t *os, void *
 
   SVN_ERR(get_ctxt_baton(&c, opt_state, pool));
   SVN_ERR(do_pget(c, opt_state->arg1,
-                  opt_state->revprop ? NULL : opt_state->arg2, pool));
+                  opt_state->revprop ? NULL : opt_state->arg2,
+                  opt_state->verbose, opt_state->show_inherited_props,
+                  pool));
   return SVN_NO_ERROR;
 }
 
@@ -2186,7 +2367,8 @@ subcommand_plist(apr_getopt_t *os, void 
 
   SVN_ERR(get_ctxt_baton(&c, opt_state, pool));
   SVN_ERR(do_plist(c, opt_state->revprop ? NULL : opt_state->arg1,
-                   opt_state->verbose, opt_state->xml, pool));
+                   opt_state->verbose, opt_state->xml,
+                   opt_state->show_inherited_props, pool));
   return SVN_NO_ERROR;
 }
 
@@ -2419,6 +2601,10 @@ main(int argc, const char *argv[])
           opt_state.diff_cmd = opt_arg;
           break;
 
+        case svnlook__show_inherited_props:
+          opt_state.show_inherited_props = TRUE;
+          break;
+
         default:
           SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
           svn_pool_destroy(pool);
@@ -2434,6 +2620,13 @@ main(int argc, const char *argv[])
                  _("The '--transaction' (-t) and '--revision' (-r) arguments "
                    "cannot co-exist")));
 
+  /* The --show-inherited-props and --revprop options may not co-exist. */
+  if (opt_state.show_inherited_props && opt_state.revprop)
+    SVN_INT_ERR(svn_error_create
+                (SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL,
+                 _("Cannot use the '--show-inherited-props' option with the "
+                   "'--revprop' option")));
+
   /* If the user asked for help, then the rest of the arguments are
      the names of subcommands to get help on (if any), or else they're
      just typos/mistakes.  Whatever the case, the subcommand to

Modified: subversion/trunk/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnserve/serve.c?rev=1416637&r1=1416636&r2=1416637&view=diff
==============================================================================
--- subversion/trunk/subversion/svnserve/serve.c (original)
+++ subversion/trunk/subversion/svnserve/serve.c Mon Dec  3 18:52:24 2012
@@ -1005,7 +1005,7 @@ get_props(apr_hash_t **props,
   /* Get any inherited properties the user is authorized to. */
   if (iprops)
     {
-      SVN_ERR(svn_repos_fs_get_inherited_props(iprops, root, path,
+      SVN_ERR(svn_repos_fs_get_inherited_props(iprops, root, path, NULL,
                                                authz_check_access_cb_func(b),
                                                b, pool, pool));
     }

Modified: subversion/trunk/subversion/tests/cmdline/svnlook_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svnlook_tests.py?rev=1416637&r1=1416636&r2=1416637&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svnlook_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svnlook_tests.py Mon Dec  3 18:52:24 2012
@@ -696,6 +696,7 @@ fp.close()"""
   # Now check the logfile
   expected_data = [ 'bogus_val\n',
                     'bogus_rev_val\n',
+                    "Properties on '/A':\n",
                     '  bogus_prop\n',
                     '  svn:log\n', '  svn:author\n',
                     '  svn:check-locks\n', # internal prop, not really expected

Modified: subversion/trunk/tools/client-side/svn-bench/cl.h
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/client-side/svn-bench/cl.h?rev=1416637&r1=1416636&r2=1416637&view=diff
==============================================================================
--- subversion/trunk/tools/client-side/svn-bench/cl.h (original)
+++ subversion/trunk/tools/client-side/svn-bench/cl.h Mon Dec  3 18:52:24 2012
@@ -149,21 +149,6 @@ svn_error_t *
 svn_cl__check_cancel(void *baton);
 
 
-/* Print to stdout a hash that maps property names (char *) to property
-   values (svn_string_t *).  The names are assumed to be in UTF-8 format;
-   the values are either in UTF-8 (the special Subversion props) or
-   plain binary values.
-
-   If OUT is not NULL, then write to it rather than stdout.
-
-   If NAMES_ONLY is true, print just names, else print names and
-   values. */
-svn_error_t *
-svn_cl__print_prop_hash(svn_stream_t *out,
-                        apr_hash_t *prop_hash,
-                        svn_boolean_t names_only,
-                        apr_pool_t *pool);
-
 
 /*** Notification functions to display results on the terminal. */
 



Mime
View raw message