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

svn commit: r1095507 - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_client/externals.c libsvn_client/prop_commands.c libsvn_wc/props.c libsvn_wc/wc_db.c libsvn_wc/wc_db.h

Author: rhuijben
Date: Wed Apr 20 20:33:18 2011
New Revision: 1095507

URL: http://svn.apache.org/viewvc?rev=1095507&view=rev
Log:
Make the streamy property read code differentiate between pristine and BASE
properties. The standard property functions in libsvn_client want to look at
pristine properties, but usually not explicitly at op_depth 0.

* In WC-NG pristine properties are unmodified properties.
* And BASE properties are the op_depth 0 properties.

Virtually no libsvn_client code should look at BASE directly.
(In the old WC-1.0 world we would call that the revert base)

* subversion/include/private/svn_wc_private.h
  (svn_wc__prop_list_recursive): Add base_props argument and extend
    documentation.

* subversion/libsvn_client/externals.c
  (svn_client__crawl_for_externals): Update caller.

* subversion/libsvn_client/prop_commands.c
  (get_prop_from_wc): Add boolean argument. Update caller.
  (svn_client_propget3,
   svn_client_proplist3): This code should look at the pristine version, not
    at the op_depth 0 version. As that will show the wrong properties when
    the node is shadowed.

* subversion/libsvn_wc/props.c
  (svn_wc__prop_list_recursive): Pass base_props argument.

* subversion/libsvn_wc/wc_db.c
  (cache_props_baton_t): Add base_props boolean.
  (cache_props_recursive): Only look at BASE when base_props is TRUE, but
     don't look at local mods if either base_props or pristine is TRUE.
  (svn_wc__db_read_props_streamily): Add base_props argument.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_read_props_streamily): Add base_props argument; update
    documentation.

Modified:
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/libsvn_client/externals.c
    subversion/trunk/subversion/libsvn_client/prop_commands.c
    subversion/trunk/subversion/libsvn_wc/props.c
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h

Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=1095507&r1=1095506&r2=1095507&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Wed Apr 20 20:33:18 2011
@@ -776,10 +776,13 @@ typedef svn_error_t *(*svn_wc__proplist_
  * If @a propname is not NULL, the passed hash table will only contain
  * the property @a propname.
  *
- * If @a pristine is @c TRUE, get the pristine (or "BASE") properties
+ * If @a base_props is @c TRUE, get the unmodified BASE properties
  * from the working copy, instead of getting the current (or "WORKING")
  * properties.
  *
+ * If @a pristine is not @c TRUE, and @a base_props is FALSE show local
+ * modifications to the properties.
+ *
  * If a node has no properties, @a receiver_func is not called for the node.
  *
  * Use @a wc_ctx to access the working copy, and @a scratch_pool for
@@ -795,6 +798,7 @@ svn_wc__prop_list_recursive(svn_wc_conte
                             const char *local_abspath,
                             const char *propname,
                             svn_depth_t depth,
+                            svn_boolean_t base_props,
                             svn_boolean_t pristine,
                             svn_wc__proplist_receiver_t receiver_func,
                             void *receiver_baton,

Modified: subversion/trunk/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=1095507&r1=1095506&r2=1095507&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/externals.c (original)
+++ subversion/trunk/subversion/libsvn_client/externals.c Wed Apr 20 20:33:18 2011
@@ -1447,7 +1447,8 @@ svn_client__crawl_for_externals(apr_hash
   apr_hash_t *externals_hash = apr_hash_make(result_pool);
 
   SVN_ERR(svn_wc__prop_list_recursive(ctx->wc_ctx, local_abspath, NULL, depth,
-                                      FALSE, /* pristine */
+                                      FALSE /* base_props */,
+                                      FALSE /* pristine */,
                                       externals_crawl_proplist_receiver,
                                       externals_hash,
                                       ctx->cancel_func,

Modified: subversion/trunk/subversion/libsvn_client/prop_commands.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/prop_commands.c?rev=1095507&r1=1095506&r2=1095507&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/trunk/subversion/libsvn_client/prop_commands.c Wed Apr 20 20:33:18 2011
@@ -866,6 +866,7 @@ static svn_error_t *
 get_prop_from_wc(apr_hash_t *props,
                  const char *propname,
                  const char *target,
+                 svn_boolean_t base_props,
                  svn_boolean_t pristine,
                  svn_node_kind_t kind,
                  svn_depth_t depth,
@@ -911,7 +912,8 @@ get_prop_from_wc(apr_hash_t *props,
   if (depth >= svn_depth_files && kind == svn_node_dir)
     {
       SVN_ERR(svn_wc__prop_list_recursive(ctx->wc_ctx, target_abspath,
-                                          propname, depth, pristine,
+                                          propname, depth,
+                                          base_props, pristine,
                                           recursive_propget_receiver, &rb,
                                           ctx->cancel_func, ctx->cancel_baton,
                                           pool));
@@ -1002,7 +1004,8 @@ svn_client_propget3(apr_hash_t **props,
       pristine = (revision->kind == svn_opt_revision_committed
                   || revision->kind == svn_opt_revision_base);
 
-      SVN_ERR(get_prop_from_wc(*props, propname, path_or_url, pristine, kind,
+      SVN_ERR(get_prop_from_wc(*props, propname, path_or_url,
+                               FALSE, pristine, kind,
                                depth, changelists, ctx, pool));
     }
   else
@@ -1318,7 +1321,8 @@ svn_client_proplist3(const char *path_or
             }
 
           SVN_ERR(svn_wc__prop_list_recursive(ctx->wc_ctx, local_abspath, NULL,
-                                              depth, pristine,
+                                              depth,
+                                              FALSE, pristine,
                                               recursive_proplist_receiver, &rb,
                                               ctx->cancel_func,
                                               ctx->cancel_baton, pool));

Modified: subversion/trunk/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.c?rev=1095507&r1=1095506&r2=1095507&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.c (original)
+++ subversion/trunk/subversion/libsvn_wc/props.c Wed Apr 20 20:33:18 2011
@@ -1675,6 +1675,7 @@ svn_wc__prop_list_recursive(svn_wc_conte
                             const char *local_abspath,
                             const char *propname,
                             svn_depth_t depth,
+                            svn_boolean_t base_props,
                             svn_boolean_t pristine,
                             svn_wc__proplist_receiver_t receiver_func,
                             void *receiver_baton,
@@ -1705,7 +1706,8 @@ svn_wc__prop_list_recursive(svn_wc_conte
     case svn_depth_immediates:
     case svn_depth_infinity:
       SVN_ERR(svn_wc__db_read_props_streamily(wc_ctx->db, local_abspath,
-                                              propname, depth, pristine,
+                                              propname, depth,
+                                              base_props, pristine,
                                               receiver_func, receiver_baton,
                                               cancel_func, cancel_baton,
                                               scratch_pool));

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1095507&r1=1095506&r2=1095507&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Wed Apr 20 20:33:18 2011
@@ -6108,6 +6108,7 @@ svn_wc__db_read_props(apr_hash_t **props
 typedef struct cache_props_baton_t
 {
   svn_boolean_t immediates_only;
+  svn_boolean_t base_props;
   svn_boolean_t pristine;
   svn_cancel_func_t cancel_func;
   void *cancel_baton;
@@ -6125,7 +6126,7 @@ cache_props_recursive(void *cb_baton,
 
   if (baton->immediates_only)
     {
-      if (baton->pristine)
+      if (baton->base_props)
         SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_CACHE_NODE_BASE_PROPS_OF_CHILDREN));
       else
@@ -6135,7 +6136,7 @@ cache_props_recursive(void *cb_baton,
     }
   else
     {
-      if (baton->pristine)
+      if (baton->base_props)
         SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                         STMT_CACHE_NODE_BASE_PROPS_RECURSIVE));
       else
@@ -6148,7 +6149,7 @@ cache_props_recursive(void *cb_baton,
   SVN_ERR(svn_sqlite__step_done(stmt));
 
   /* ACTUAL props aren't relevant in the pristine case. */
-  if (baton->pristine)
+  if (baton->base_props || baton->pristine)
     return SVN_NO_ERROR;
 
   if (baton->cancel_func)
@@ -6179,6 +6180,7 @@ svn_wc__db_read_props_streamily(svn_wc__
                                 const char *local_abspath,
                                 const char *propname,
                                 svn_depth_t depth,
+                                svn_boolean_t base_props,
                                 svn_boolean_t pristine,
                                 svn_wc__proplist_receiver_t receiver_func,
                                 void *receiver_baton,
@@ -6212,6 +6214,7 @@ svn_wc__db_read_props_streamily(svn_wc__
                                       STMT_CLEAR_NODE_PROPS_CACHE));
 
   baton.immediates_only = immediates_only;
+  baton.base_props = base_props;
   baton.pristine = pristine;
   baton.cancel_func = cancel_func;
   baton.cancel_baton = cancel_baton;

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1095507&r1=1095506&r2=1095507&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Wed Apr 20 20:33:18 2011
@@ -1714,9 +1714,15 @@ svn_wc__db_read_props(apr_hash_t **props
 /* Call RECEIVER_FUNC, passing RECEIVER_BATON, an absolute path, and
  * a hash table mapping <tt>char *</tt> names onto svn_string_t *
  * values for any properties of child nodes of LOCAL_ABSPATH (up to DEPTH).
- * If PRISTINE is TRUE, read the pristine props (op_depth = 0).
- * If PROPNAME is not NULL, the passed hash table will only contain
- * the property PROPNAME.
+ *
+ * If BASE_PROPS is TRUE, read the properties from the BASE layer (op_depth=0),
+ * without local modifications.
+ *
+ * If BASE_PROPS is FALSE, read the properties from the WORKING layer (highest
+ * op_depth).
+ *
+ * If BASE_PROPS is FALSE and, PRISTINE is TRUE, the local modifications will
+ * be suppressed. If PRISTINE is FALSE, local modifications will be visible.
  *
  * NOTE: The only valid values for DEPTH are svn_depth_files,
  *       svn_depth_immediates, and svn_depth_infinity.
@@ -1726,6 +1732,7 @@ svn_wc__db_read_props_streamily(svn_wc__
                                 const char *local_abspath,
                                 const char *propname,
                                 svn_depth_t depth,
+                                svn_boolean_t base_props,
                                 svn_boolean_t pristine,
                                 svn_wc__proplist_receiver_t receiver_func,
                                 void *receiver_baton,



Re: svn commit: r1095507 - in /subversion/trunk/subversion: include/private/svn_wc_private.h libsvn_client/externals.c libsvn_client/prop_commands.c libsvn_wc/props.c libsvn_wc/wc_db.c libsvn_wc/wc_db.h

Posted by Greg Stein <gs...@gmail.com>.
On Wed, Apr 20, 2011 at 16:33,  <rh...@apache.org> wrote:
> Author: rhuijben
> Date: Wed Apr 20 20:33:18 2011
> New Revision: 1095507
>
> URL: http://svn.apache.org/viewvc?rev=1095507&view=rev
> Log:
> Make the streamy property read code differentiate between pristine and BASE
> properties. The standard property functions in libsvn_client want to look at
> pristine properties, but usually not explicitly at op_depth 0.
>
> * In WC-NG pristine properties are unmodified properties.
> * And BASE properties are the op_depth 0 properties.
>
> Virtually no libsvn_client code should look at BASE directly.
> (In the old WC-1.0 world we would call that the revert base)

Right. So why provide a way for the client to do this? I don't see any
of these calls where base_props=TRUE, so why add the parameter?

(and "for the future" doesn't sit well with me)

Do you have an upcoming change where the client needs to read the BASE props?

>...

Cheers,
-g