subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pbu...@apache.org
Subject svn commit: r1326830 - in /subversion/branches/inheritable-props/subversion: include/private/svn_cmdline_private.h libsvn_subr/cmdline.c svn/cl.h svn/log-cmd.c svn/propget-cmd.c svn/proplist-cmd.c svn/props.c svnlook/main.c
Date Mon, 16 Apr 2012 23:39:34 GMT
Author: pburba
Date: Mon Apr 16 23:39:34 2012
New Revision: 1326830

URL: http://svn.apache.org/viewvc?rev=1326830&view=rev
Log:
On the inheritable-props branch: Add xml output of inherited props.

* subversion/include/private/svn_cmdline_private.h
  (svn_cmdline__print_xml_prop): Add ability to print inherited or explicit
   properties.

* subversion/libsvn_subr/cmdline.c
  (svn_cmdline__print_xml_prop): Implement the above.

* subversion/svn/log-cmd.c
  (log_entry_receiver_xml): Update call to svn_cl__print_xml_prop_hash, no
   functional change.

* subversion/svn/propget-cmd.c
  (print_properties_xml): Add ability to print inherited or explicit
   properties.

  (svn_cl__propget): Print either explicit or inherited props.

* subversion/svn/proplist-cmd.c
  (proplist_receiver_xml): Print either explicit or inherited props.

  (svn_cl__proplist): Update call to svn_cl__print_xml_prop_hash, no
   functional change.

* subversion/svn/cl.h
  (svn_cl__print_xml_prop_hash): Add ability to print inherited or explicit
   properties.

* subversion/svn/props.c
  (svn_cl__print_xml_prop_hash): Implement the above.

* subversion/svnlook/main.c
  (do_plist): Update call to svn_cmdline__print_xml_prop, no functional
   change.

Modified:
    subversion/branches/inheritable-props/subversion/include/private/svn_cmdline_private.h
    subversion/branches/inheritable-props/subversion/libsvn_subr/cmdline.c
    subversion/branches/inheritable-props/subversion/svn/cl.h
    subversion/branches/inheritable-props/subversion/svn/log-cmd.c
    subversion/branches/inheritable-props/subversion/svn/propget-cmd.c
    subversion/branches/inheritable-props/subversion/svn/proplist-cmd.c
    subversion/branches/inheritable-props/subversion/svn/props.c
    subversion/branches/inheritable-props/subversion/svnlook/main.c

Modified: subversion/branches/inheritable-props/subversion/include/private/svn_cmdline_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/include/private/svn_cmdline_private.h?rev=1326830&r1=1326829&r2=1326830&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/include/private/svn_cmdline_private.h
(original)
+++ subversion/branches/inheritable-props/subversion/include/private/svn_cmdline_private.h
Mon Apr 16 23:39:34 2012
@@ -44,12 +44,14 @@ extern "C" {
  * @a propname is the property name. @a propval is the property value, which
  * will be encoded if it contains unsafe bytes.
  *
- * @since New in 1.6.
+ * If @a inherited_prop is TRUE then @a propname is an inherited property,
+ * otherwise @a propname is an explicit property.
  */
 void
 svn_cmdline__print_xml_prop(svn_stringbuf_t **outstr,
                             const char *propname,
                             svn_string_t *propval,
+                            svn_boolean_t inherited_prop,
                             apr_pool_t *pool);
 
 

Modified: subversion/branches/inheritable-props/subversion/libsvn_subr/cmdline.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/libsvn_subr/cmdline.c?rev=1326830&r1=1326829&r2=1326830&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/libsvn_subr/cmdline.c (original)
+++ subversion/branches/inheritable-props/subversion/libsvn_subr/cmdline.c Mon Apr 16 23:39:34
2012
@@ -631,6 +631,7 @@ void
 svn_cmdline__print_xml_prop(svn_stringbuf_t **outstr,
                             const char* propname,
                             svn_string_t *propval,
+                            svn_boolean_t inherited_prop,
                             apr_pool_t *pool)
 {
   const char *xml_safe;
@@ -654,16 +655,22 @@ svn_cmdline__print_xml_prop(svn_stringbu
     }
 
   if (encoding)
-    svn_xml_make_open_tag(outstr, pool, svn_xml_protect_pcdata,
-                          "property", "name", propname,
-                          "encoding", encoding, NULL);
+    svn_xml_make_open_tag(
+      outstr, pool, svn_xml_protect_pcdata,
+      inherited_prop ? "inherited_property" : "property",
+      "name", propname,
+      "encoding", encoding, NULL);
   else
-    svn_xml_make_open_tag(outstr, pool, svn_xml_protect_pcdata,
-                          "property", "name", propname, NULL);
+    svn_xml_make_open_tag(
+      outstr, pool, svn_xml_protect_pcdata,
+      inherited_prop ? "inherited_property" : "property",
+      "name", propname, NULL);
 
   svn_stringbuf_appendcstr(*outstr, xml_safe);
 
-  svn_xml_make_close_tag(outstr, pool, "property");
+  svn_xml_make_close_tag(
+    outstr, pool,
+    inherited_prop ? "inherited_property" : "property");
 
   return;
 }

Modified: subversion/branches/inheritable-props/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/svn/cl.h?rev=1326830&r1=1326829&r2=1326830&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/svn/cl.h (original)
+++ subversion/branches/inheritable-props/subversion/svn/cl.h Mon Apr 16 23:39:34 2012
@@ -451,12 +451,15 @@ svn_cl__print_prop_hash(svn_stream_t *ou
                         svn_boolean_t names_only,
                         apr_pool_t *pool);
 
-/* Same as svn_cl__print_prop_hash(), only output xml to *OUTSTR.  If *OUTSTR is
-   NULL, allocate it first from POOL, otherwise append to it. */
+/* 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

Modified: subversion/branches/inheritable-props/subversion/svn/log-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/svn/log-cmd.c?rev=1326830&r1=1326829&r2=1326830&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/svn/log-cmd.c (original)
+++ subversion/branches/inheritable-props/subversion/svn/log-cmd.c Mon Apr 16 23:39:34 2012
@@ -490,7 +490,7 @@ log_entry_receiver_xml(void *baton,
       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 */
-                                          pool));
+                                          FALSE, pool));
       svn_xml_make_close_tag(&sb, pool, "revprops");
     }
 

Modified: subversion/branches/inheritable-props/subversion/svn/propget-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/svn/propget-cmd.c?rev=1326830&r1=1326829&r2=1326830&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/svn/propget-cmd.c (original)
+++ subversion/branches/inheritable-props/subversion/svn/propget-cmd.c Mon Apr 16 23:39:34
2012
@@ -69,28 +69,58 @@ stream_write(svn_stream_t *out,
 static svn_error_t *
 print_properties_xml(const char *pname,
                      apr_hash_t *props,
+                     apr_array_header_t *inherited_props,
                      apr_pool_t *pool)
 {
   apr_hash_index_t *hi;
-  apr_pool_t *iterpool = svn_pool_create(pool);
+  apr_pool_t *iterpool = NULL;
+  int i;
+  svn_stringbuf_t *sb;
+
+  if (inherited_props && inherited_props->nelts)
+    {
+      iterpool = svn_pool_create(pool);
+
+      for (i = 0; i < inherited_props->nelts; i++)
+        {
+          svn_prop_inherited_item_t *iprop =
+           APR_ARRAY_IDX(inherited_props, i, svn_prop_inherited_item_t *);
+          svn_string_t *propval = svn__apr_hash_index_val(
+            apr_hash_first(pool, iprop->prop_hash));
+
+          sb = NULL;
+          svn_pool_clear(iterpool);
+          svn_xml_make_open_tag(&sb, iterpool, svn_xml_normal, "target",
+                            "path", iprop->path_or_url, NULL);
+
+          svn_cmdline__print_xml_prop(&sb, pname, propval, TRUE, iterpool);
+          svn_xml_make_close_tag(&sb, iterpool, "target");
+
+          SVN_ERR(svn_cl__error_checked_fputs(sb->data, stdout));
+        }
+    }
+
+  if (iterpool == NULL)
+    iterpool = svn_pool_create(iterpool);
 
   for (hi = apr_hash_first(pool, props); hi; hi = apr_hash_next(hi))
     {
       const char *filename = svn__apr_hash_index_key(hi);
       svn_string_t *propval = svn__apr_hash_index_val(hi);
-      svn_stringbuf_t *sb = NULL;
 
+      sb = NULL;
       svn_pool_clear(iterpool);
 
       svn_xml_make_open_tag(&sb, iterpool, svn_xml_normal, "target",
                         "path", filename, NULL);
-      svn_cmdline__print_xml_prop(&sb, pname, propval, iterpool);
+      svn_cmdline__print_xml_prop(&sb, pname, propval, FALSE, iterpool);
       svn_xml_make_close_tag(&sb, iterpool, "target");
 
       SVN_ERR(svn_cl__error_checked_fputs(sb->data, stdout));
     }
 
-  svn_pool_destroy(iterpool);
+  if (iterpool)
+    svn_pool_destroy(iterpool);
 
   return SVN_NO_ERROR;
 }
@@ -317,7 +347,8 @@ svn_cl__propget(apr_getopt_t *os,
                                     "revprops",
                                     "rev", revstr, NULL);
 
-              svn_cmdline__print_xml_prop(&sb, pname_utf8, propval, pool);
+              svn_cmdline__print_xml_prop(&sb, pname_utf8, propval, FALSE,
+                                          pool);
 
               svn_xml_make_close_tag(&sb, pool, "revprops");
 
@@ -407,7 +438,10 @@ svn_cl__propget(apr_getopt_t *os,
           like_proplist = opt_state->verbose && !opt_state->strict;
 
           if (opt_state->xml)
-            SVN_ERR(print_properties_xml(pname_utf8, props, subpool));
+            SVN_ERR(print_properties_xml(
+              pname_utf8, props,
+              opt_state->show_inherited_props ? inherited_props : NULL,
+              subpool));
           else
             SVN_ERR(print_properties(
               out, pname_utf8,

Modified: subversion/branches/inheritable-props/subversion/svn/proplist-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/svn/proplist-cmd.c?rev=1326830&r1=1326829&r2=1326830&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/svn/proplist-cmd.c (original)
+++ subversion/branches/inheritable-props/subversion/svn/proplist-cmd.c Mon Apr 16 23:39:34
2012
@@ -60,20 +60,50 @@ proplist_receiver_xml(void *baton,
 {
   svn_cl__opt_state_t *opt_state = ((proplist_baton_t *)baton)->opt_state;
   svn_boolean_t is_url = ((proplist_baton_t *)baton)->is_url;
-  svn_stringbuf_t *sb = NULL;
+  svn_stringbuf_t *sb;
   const char *name_local;
 
+  if (inherited_props && inherited_props->nelts)
+    {
+      int i;
+      apr_pool_t *iterpool = svn_pool_create(pool);
+
+      for (i = 0; i < inherited_props->nelts; i++)
+        {
+          svn_prop_inherited_item_t *iprop =
+            APR_ARRAY_IDX(inherited_props, i, svn_prop_inherited_item_t *);
+
+          sb = NULL;
+
+          if (svn_path_is_url(iprop->path_or_url))
+            name_local = iprop->path_or_url;
+          else
+            name_local = svn_dirent_local_style(iprop->path_or_url, iterpool);
+
+          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_xml_make_close_tag(&sb, iterpool, "target");
+          svn_cl__error_checked_fputs(sb->data, stdout);
+        }
+      svn_pool_destroy(iterpool);
+    }
+
   if (! is_url)
     name_local = svn_dirent_local_style(path, pool);
   else
     name_local = path;
 
+  sb = NULL;
+
   /* "<target ...>" */
   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),
-                                      pool));
+                                      FALSE, pool));
 
   /* "</target>" */
   svn_xml_make_close_tag(&sb, pool, "target");
@@ -178,8 +208,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), scratch_pool));
+          SVN_ERR(svn_cl__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));

Modified: subversion/branches/inheritable-props/subversion/svn/props.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/svn/props.c?rev=1326830&r1=1326829&r2=1326830&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/svn/props.c (original)
+++ subversion/branches/inheritable-props/subversion/svn/props.c Mon Apr 16 23:39:34 2012
@@ -151,6 +151,7 @@ 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_hash_index_t *hi;
@@ -165,8 +166,10 @@ svn_cl__print_xml_prop_hash(svn_stringbu
 
       if (names_only)
         {
-          svn_xml_make_open_tag(outstr, pool, svn_xml_self_closing, "property",
-                                "name", pname, NULL);
+          svn_xml_make_open_tag(
+            outstr, pool, svn_xml_self_closing,
+            inherited_props ? "inherited_property" : "property",
+            "name", pname, NULL);
         }
       else
         {
@@ -178,7 +181,8 @@ svn_cl__print_xml_prop_hash(svn_stringbu
 
           SVN_ERR(svn_cmdline_cstring_from_utf8(&pname_out, pname, pool));
 
-          svn_cmdline__print_xml_prop(outstr, pname_out, propval, pool);
+          svn_cmdline__print_xml_prop(outstr, pname_out, propval,
+                                      inherited_props, pool);
         }
     }
 

Modified: subversion/branches/inheritable-props/subversion/svnlook/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/svnlook/main.c?rev=1326830&r1=1326829&r2=1326830&view=diff
==============================================================================
--- subversion/branches/inheritable-props/subversion/svnlook/main.c (original)
+++ subversion/branches/inheritable-props/subversion/svnlook/main.c Mon Apr 16 23:39:34 2012
@@ -1790,7 +1790,7 @@ do_plist(svnlook_ctxt_t *c,
       if (verbose)
         {
           if (xml)
-            svn_cmdline__print_xml_prop(&sb, pname, propval, pool);
+            svn_cmdline__print_xml_prop(&sb, pname, propval, FALSE, pool);
           else
             {
               const char *pname_stdout;



Mime
View raw message