You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by pb...@apache.org on 2012/12/20 22:19:09 UTC

svn commit: r1424708 - in /subversion/trunk/subversion: include/ libsvn_client/ libsvn_ra/ libsvn_wc/

Author: pburba
Date: Thu Dec 20 21:19:08 2012
New Revision: 1424708

URL: http://svn.apache.org/viewvc?rev=1424708&view=rev
Log:
Store repos root relative paths in NODES.INHERITED_PROPS rather than full
URLs.

See http://svn.haxx.se/dev/archive-2012-12/0427.shtml

* subversion/include/svn_ra.h

  (svn_ra_get_inherited_props): Add a new argument allowing the API to
   retrieve an array of svn_prop_inherited_item_t items with the path_or_url
   member set to either a URL or (new) a repos relpath.

* subversion/libsvn_client/client.h

  (svn_client__get_inheritable_props): Same as svn_ra_get_inherited_props().

* subversion/libsvn_client/externals.c
  (switch_file_external):
* subversion/libsvn_client/update.c
  (update_internal):
* subversion/libsvn_client/switch.c
  (switch_internal):
   Update calls to svn_ra_get_inherited_props() in all these functions,
   getting svn_prop_inherited_item_t's keyed on relpaths rather than
   URLs as before.

* subversion/libsvn_client/iprops.c

  (svn_client__get_inheritable_props): Implement new argument.

* subversion/libsvn_client/prop_commands.c

  (remote_propget,
   remote_proplist): Update call to svn_ra_get_inherited_props(),
   getting svn_prop_inherited_item_t's keyed on URLs as before.

* subversion/libsvn_ra/ra_loader.c

  (svn_ra_get_inherited_props): Implement new argument.

* subversion/libsvn_wc/wc_db.c

  (read_inherited_props_baton_t): Add new member tracking the repos root URL.

  (db_read_inherited_props): Convert repos rel paths to URLs in output.

  (svn_wc__db_read_inherited_props): Initialize new baton member.

Modified:
    subversion/trunk/subversion/include/svn_ra.h
    subversion/trunk/subversion/libsvn_client/client.h
    subversion/trunk/subversion/libsvn_client/externals.c
    subversion/trunk/subversion/libsvn_client/iprops.c
    subversion/trunk/subversion/libsvn_client/prop_commands.c
    subversion/trunk/subversion/libsvn_client/switch.c
    subversion/trunk/subversion/libsvn_client/update.c
    subversion/trunk/subversion/libsvn_ra/ra_loader.c
    subversion/trunk/subversion/libsvn_wc/wc_db.c

Modified: subversion/trunk/subversion/include/svn_ra.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_ra.h?rev=1424708&r1=1424707&r2=1424708&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_ra.h (original)
+++ subversion/trunk/subversion/include/svn_ra.h Thu Dec 20 21:19:08 2012
@@ -1930,6 +1930,12 @@ svn_ra_get_deleted_rev(svn_ra_session_t 
  * inheritable properties are found, then set @a *inherited_props to
  * an empty array.
  *
+ * If @a use_relpath_keys is true, then the
+ * #svn_prop_inherited_item_t->path_or_url members of the
+ * #svn_prop_inherited_item_t * structures in @a *inherited_props are
+ * paths relative to the repository root URL (of the repository which
+ * @a ra_session is associated).  Otherwise these members are URLs.
+ *
  * Allocated @a *inherited_props in @a result_pool, use @a scratch_pool
  * for temporary allocations.
  *
@@ -1940,6 +1946,7 @@ svn_ra_get_inherited_props(svn_ra_sessio
                            apr_array_header_t **inherited_props,
                            const char *path,
                            svn_revnum_t revision,
+                           svn_boolean_t use_relpath_keys,
                            apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool);
 

Modified: subversion/trunk/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=1424708&r1=1424707&r2=1424708&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/client.h (original)
+++ subversion/trunk/subversion/libsvn_client/client.h Thu Dec 20 21:19:08 2012
@@ -653,7 +653,10 @@ svn_client__list_internal(const char *pa
    as any WC roots under LOCAL_ABSPATH (as limited by DEPTH) using
    RA_SESSION.  Store the results in *WCROOT_IPROPS, a hash mapping
    const char * absolute working copy paths to depth-first ordered arrays
-   of svn_prop_inherited_item_t * structures.
+   of svn_prop_inherited_item_t * structures.  If WANT_RELPATH_KEYS is true,
+   then any svn_prop_inherited_item_t->path_or_url members returned in
+   *WCROOT_IPROPS are repository relative paths, otherwise these members are
+   URLs.
 
    If LOCAL_ABSPATH has no base then do nothing.
 
@@ -668,6 +671,7 @@ svn_client__get_inheritable_props(apr_ha
                                   const char *local_abspath,
                                   svn_revnum_t revision,
                                   svn_depth_t depth,
+                                  svn_boolean_t use_relpath_keys,
                                   svn_ra_session_t *ra_session,
                                   svn_client_ctx_t *ctx,
                                   apr_pool_t *result_pool,

Modified: subversion/trunk/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=1424708&r1=1424707&r2=1424708&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/externals.c (original)
+++ subversion/trunk/subversion/libsvn_client/externals.c Thu Dec 20 21:19:08 2012
@@ -484,7 +484,8 @@ switch_file_external(const char *local_a
                                               ctx, subpool));
     /* Get the external file's iprops. */
     SVN_ERR(svn_ra_get_inherited_props(ra_session, &inherited_props, "",
-                                       switch_loc->rev, subpool, subpool));
+                                       switch_loc->rev, TRUE,
+                                       subpool, subpool));
 
     SVN_ERR(svn_ra_reparent(ra_session, svn_uri_dirname(url, subpool),
                             subpool));

Modified: subversion/trunk/subversion/libsvn_client/iprops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/iprops.c?rev=1424708&r1=1424707&r2=1424708&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/iprops.c (original)
+++ subversion/trunk/subversion/libsvn_client/iprops.c Thu Dec 20 21:19:08 2012
@@ -81,6 +81,7 @@ svn_client__get_inheritable_props(apr_ha
                                   const char *local_abspath,
                                   svn_revnum_t revision,
                                   svn_depth_t depth,
+                                  svn_boolean_t use_relpath_keys,
                                   svn_ra_session_t *ra_session,
                                   svn_client_ctx_t *ctx,
                                   apr_pool_t *result_pool,
@@ -163,8 +164,8 @@ svn_client__get_inheritable_props(apr_ha
             }
 
           SVN_ERR(svn_ra_get_inherited_props(ra_session, &inherited_props,
-                                             "", revision, result_pool,
-                                             iterpool));
+                                             "", revision, use_relpath_keys,
+                                             result_pool, iterpool));
           apr_hash_set(*wcroot_iprops,
                        apr_pstrdup(result_pool, child_abspath),
                        APR_HASH_KEY_STRING,

Modified: subversion/trunk/subversion/libsvn_client/prop_commands.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/prop_commands.c?rev=1424708&r1=1424707&r2=1424708&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/trunk/subversion/libsvn_client/prop_commands.c Thu Dec 20 21:19:08 2012
@@ -639,7 +639,7 @@ remote_propget(apr_hash_t *props,
       /* We will filter out all but PROPNAME later, making a final copy
          in RESULT_POOL, so pass SCRATCH_POOL for both pools. */
       SVN_ERR(svn_ra_get_inherited_props(ra_session, inherited_props,
-                                         target_relative, revnum,
+                                         target_relative, revnum, FALSE,
                                          scratch_pool, scratch_pool));
     }
 
@@ -1125,7 +1125,7 @@ remote_proplist(const char *target_prefi
 
   if (get_target_inherited_props)
     SVN_ERR(svn_ra_get_inherited_props(ra_session, &inherited_props,
-                                       target_relative, revnum,
+                                       target_relative, revnum, FALSE,
                                        result_pool, scratch_pool));
   else
     inherited_props = NULL;

Modified: subversion/trunk/subversion/libsvn_client/switch.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/switch.c?rev=1424708&r1=1424707&r2=1424708&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/switch.c (original)
+++ subversion/trunk/subversion/libsvn_client/switch.c Thu Dec 20 21:19:08 2012
@@ -267,7 +267,7 @@ switch_internal(svn_revnum_t *result_rev
       if (needs_iprop_cache)
         {
           SVN_ERR(svn_ra_get_inherited_props(ra_session, &inherited_props,
-                                             "", switch_loc->rev, pool,
+                                             "", switch_loc->rev, TRUE, pool,
                                              pool));
           apr_hash_set(wcroot_iprops, local_abspath, APR_HASH_KEY_STRING,
                        inherited_props);

Modified: subversion/trunk/subversion/libsvn_client/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/update.c?rev=1424708&r1=1424707&r2=1424708&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/update.c (original)
+++ subversion/trunk/subversion/libsvn_client/update.c Thu Dec 20 21:19:08 2012
@@ -377,8 +377,8 @@ update_internal(svn_revnum_t *result_rev
   dfb.anchor_url = anchor_loc->url;
 
   err = svn_client__get_inheritable_props(&wcroot_iprops, local_abspath,
-                                          revnum, depth, ra_session, ctx,
-                                          pool, pool);
+                                          revnum, depth, TRUE, ra_session,
+                                          ctx, pool, pool);
 
   /* We might be trying to update to a non-existant path-rev. */
   if (err)

Modified: subversion/trunk/subversion/libsvn_ra/ra_loader.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra/ra_loader.c?rev=1424708&r1=1424707&r2=1424708&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra/ra_loader.c (original)
+++ subversion/trunk/subversion/libsvn_ra/ra_loader.c Thu Dec 20 21:19:08 2012
@@ -1298,6 +1298,7 @@ svn_ra_get_inherited_props(svn_ra_sessio
                            apr_array_header_t **iprops,
                            const char *path,
                            svn_revnum_t revision,
+                           svn_boolean_t use_relpath_keys,
                            apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool)
 {
@@ -1323,6 +1324,23 @@ svn_ra_get_inherited_props(svn_ra_sessio
                                                result_pool, scratch_pool));
     }
 
+  if (use_relpath_keys && (*iprops)->nelts)
+    {
+      const char *repos_root_url;
+      int i;
+
+      SVN_ERR(svn_ra_get_repos_root2(session, &repos_root_url, scratch_pool));
+      for (i = 0; i < (*iprops)->nelts; i++)
+        {
+          svn_prop_inherited_item_t *elt =
+            APR_ARRAY_IDX(*iprops, i, svn_prop_inherited_item_t *);
+          elt->path_or_url =
+            svn_dirent_skip_ancestor(repos_root_url, elt->path_or_url);
+          elt->path_or_url = svn_path_uri_decode(elt->path_or_url,
+                                                 result_pool);
+        }
+    }
+
   return SVN_NO_ERROR;
 }
 

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1424708&r1=1424707&r2=1424708&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Dec 20 21:19:08 2012
@@ -9151,6 +9151,7 @@ struct read_inherited_props_baton_t
 {
   apr_array_header_t *iprops;
   const char *propname;
+  const char *repos_root_url;
   apr_pool_t *result_pool;
 };
 
@@ -9273,7 +9274,15 @@ db_read_inherited_props(void *baton,
 
           /* If we didn't filter everything then keep this iprop. */
           if (apr_hash_count(cached_iprop->prop_hash))
-            svn_sort__array_insert(&cached_iprop, ripb->iprops, 0);
+            {
+              /* Convert the repository relative path in the
+                 cache to a full URL. */
+              cached_iprop->path_or_url =
+                svn_path_url_add_component2(ripb->repos_root_url,
+                                            cached_iprop->path_or_url,
+                                            result_pool);
+              svn_sort__array_insert(&cached_iprop, ripb->iprops, 0);
+            }
         }
     }
 
@@ -9292,9 +9301,14 @@ svn_wc__db_read_inherited_props(apr_arra
   svn_wc__db_wcroot_t *wcroot;
   const char *local_relpath;
   struct read_inherited_props_baton_t ripb;
+  const char *repos_root_url;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
+  SVN_ERR(svn_wc__internal_get_repos_info(&repos_root_url, NULL, db,
+                                          local_abspath, scratch_pool,
+                                          scratch_pool));
+
   SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
                                                 db, local_abspath,
                                                 scratch_pool, scratch_pool));
@@ -9302,6 +9316,7 @@ svn_wc__db_read_inherited_props(apr_arra
 
   ripb.iprops = NULL;
   ripb.propname = propname;
+  ripb.repos_root_url = repos_root_url;
   ripb.result_pool = result_pool;
 
   SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, db_read_inherited_props,



Re: svn commit: r1424708 - in /subversion/trunk/subversion: include/ libsvn_client/ libsvn_ra/ libsvn_wc/

Posted by Julian Foad <ju...@btopenworld.com>.
Paul Burba wrote:

> On Thu, Dec 20, 2012 at 4:56 PM, Julian Foad wrote:
>>>  Author: pburba
>>>  Date: Thu Dec 20 21:19:08 2012
>>>  New Revision: 1424708
>>> 
>>>  URL: http://svn.apache.org/viewvc?rev=1424708&view=rev
>>>  Log:
>>>  Store repos root relative paths in NODES.INHERITED_PROPS rather than full
>>>  URLs.
>> 
>>  Glad to see this, overall.  One concern:
>> 
>>>  See http://svn.haxx.se/dev/archive-2012-12/0427.shtml
>>> 
>>>  * subversion/include/svn_ra.h
>>> 
>>>    (svn_ra_get_inherited_props): Add a new argument allowing the API to
>>>     retrieve an array of svn_prop_inherited_item_t items with the 
>>>     path_or_url member set to either a URL or (new) a repos relpath.
>> 
>>  Eww.  Can't we have this function do one thing and do it well?
>> 
>>  Let the higher layers convert to full URLs if they need to.
> 
> Agreed and done in r1430638.

Thanks, Paul.  Looks good.

- Julian

Re: svn commit: r1424708 - in /subversion/trunk/subversion: include/ libsvn_client/ libsvn_ra/ libsvn_wc/

Posted by Paul Burba <pt...@gmail.com>.
On Thu, Dec 20, 2012 at 4:56 PM, Julian Foad <ju...@btopenworld.com> wrote:
>> Author: pburba
>
>> Date: Thu Dec 20 21:19:08 2012
>> New Revision: 1424708
>>
>> URL: http://svn.apache.org/viewvc?rev=1424708&view=rev
>> Log:
>> Store repos root relative paths in NODES.INHERITED_PROPS rather than full
>> URLs.
>
> Glad to see this, overall.  One concern:
>
>> See http://svn.haxx.se/dev/archive-2012-12/0427.shtml
>>
>> * subversion/include/svn_ra.h
>>
>>   (svn_ra_get_inherited_props): Add a new argument allowing the API to
>>    retrieve an array of svn_prop_inherited_item_t items with the path_or_url
>>    member set to either a URL or (new) a repos relpath.
>
> Eww.  Can't we have this function do one thing and do it well?
>
> Let the higher layers convert to full URLs if they need to.

Agreed and done in r1430638.

>> * subversion/libsvn_client/client.h
>>
>>   (svn_client__get_inheritable_props): Same as svn_ra_get_inherited_props().
>>
>> * subversion/libsvn_client/externals.c
>>   (switch_file_external):
>> * subversion/libsvn_client/update.c
>>   (update_internal):
>> * subversion/libsvn_client/switch.c
>>   (switch_internal):
>>    Update calls to svn_ra_get_inherited_props() in all these functions,
>>    getting svn_prop_inherited_item_t's keyed on relpaths rather than
>>    URLs as before.
>>
>> * subversion/libsvn_client/iprops.c
>>
>>   (svn_client__get_inheritable_props): Implement new argument.
>>
>> * subversion/libsvn_client/prop_commands.c
>>
>>   (remote_propget,
>>    remote_proplist): Update call to svn_ra_get_inherited_props(),
>>    getting svn_prop_inherited_item_t's keyed on URLs as before.
>>
>> * subversion/libsvn_ra/ra_loader.c
>>
>>   (svn_ra_get_inherited_props): Implement new argument.
>>
>> * subversion/libsvn_wc/wc_db.c
>>
>>   (read_inherited_props_baton_t): Add new member tracking the repos root URL.
>>
>>   (db_read_inherited_props): Convert repos rel paths to URLs in output.
>
> Same here.

Ditto.

-- 
Paul T. Burba
CollabNet, Inc. -- www.collab.net -- Enterprise Cloud Development
Skype: ptburba

Re: svn commit: r1424708 - in /subversion/trunk/subversion: include/ libsvn_client/ libsvn_ra/ libsvn_wc/

Posted by Julian Foad <ju...@btopenworld.com>.
> Author: pburba

> Date: Thu Dec 20 21:19:08 2012
> New Revision: 1424708
> 
> URL: http://svn.apache.org/viewvc?rev=1424708&view=rev
> Log:
> Store repos root relative paths in NODES.INHERITED_PROPS rather than full
> URLs.

Glad to see this, overall.  One concern:

> See http://svn.haxx.se/dev/archive-2012-12/0427.shtml
> 
> * subversion/include/svn_ra.h
> 
>   (svn_ra_get_inherited_props): Add a new argument allowing the API to
>    retrieve an array of svn_prop_inherited_item_t items with the path_or_url
>    member set to either a URL or (new) a repos relpath.

Eww.  Can't we have this function do one thing and do it well?

Let the higher layers convert to full URLs if they need to.

> * subversion/libsvn_client/client.h
> 
>   (svn_client__get_inheritable_props): Same as svn_ra_get_inherited_props().
> 
> * subversion/libsvn_client/externals.c
>   (switch_file_external):
> * subversion/libsvn_client/update.c
>   (update_internal):
> * subversion/libsvn_client/switch.c
>   (switch_internal):
>    Update calls to svn_ra_get_inherited_props() in all these functions,
>    getting svn_prop_inherited_item_t's keyed on relpaths rather than
>    URLs as before.
> 
> * subversion/libsvn_client/iprops.c
> 
>   (svn_client__get_inheritable_props): Implement new argument.
> 
> * subversion/libsvn_client/prop_commands.c
> 
>   (remote_propget,
>    remote_proplist): Update call to svn_ra_get_inherited_props(),
>    getting svn_prop_inherited_item_t's keyed on URLs as before.
> 
> * subversion/libsvn_ra/ra_loader.c
> 
>   (svn_ra_get_inherited_props): Implement new argument.
> 
> * subversion/libsvn_wc/wc_db.c
> 
>   (read_inherited_props_baton_t): Add new member tracking the repos root URL.
> 
>   (db_read_inherited_props): Convert repos rel paths to URLs in output.

Same here.

>   (svn_wc__db_read_inherited_props): Initialize new baton member.

- Julian