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

svn commit: r935719 - in /subversion/trunk/subversion: libsvn_client/prop_commands.c tests/cmdline/prop_tests.py

Author: gstein
Date: Mon Apr 19 20:02:15 2010
New Revision: 935719

URL: http://svn.apache.org/viewvc?rev=935719&view=rev
Log:
Update prop_commands to use the new pristine property interface, but don't
quite trust it yet. Rearrange the code to fetch properties using this new
interface, with the extra trust-covering bits. This allows us to isolate a
couple node functions for future changes.

This changes "svn proplist LOCALLY-DELETED" to return an empty list. I
believe this is correct. If you want the pristine properties, then use
"svn proplist LOCALLY-DELETED@base" or @committed.

* subversion/libsvn_client/prop_commands.c:
  (pristine_or_working_props): use svn_wc_get_pristine_props() when
    requested. watch out for added nodes, and return NULL props. also
    watch out for locally-deleted nodes and return NULL for the "current"
    properties.
  (pristine_or_working_propval): fetch the set of properties using the
    adjusted pristine_or_working_props function, and be aware of a
    possible NULL props value.
  (proplist_walk_cb): remove the status testing, and just rely on a NULL
    return from pristine_or_working_props. rename localvar to PROPS.

* subversion/tests/cmdline/prop_tests.py:
  (rm_of_replaced_file): the locally-deleted mu should have no current
    properties, but they *do* remain on BASE.

Modified:
    subversion/trunk/subversion/libsvn_client/prop_commands.c
    subversion/trunk/subversion/tests/cmdline/prop_tests.py

Modified: subversion/trunk/subversion/libsvn_client/prop_commands.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/prop_commands.c?rev=935719&r1=935718&r2=935719&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/trunk/subversion/libsvn_client/prop_commands.c Mon Apr 19 20:02:15 2010
@@ -518,11 +518,46 @@ pristine_or_working_props(apr_hash_t **p
                           apr_pool_t *scratch_pool)
 {
   if (pristine)
-    return svn_wc_get_prop_diffs2(NULL, props, wc_ctx, local_abspath,
-                                  result_pool, scratch_pool);
-  else
-    return svn_wc_prop_list2(props, wc_ctx, local_abspath, result_pool,
-                             scratch_pool);
+    {
+      /* ### right now, we're not entirely sure that get_pristine_props
+         ### will return NULL for the added case. let's double-check.  */
+      {
+        svn_boolean_t added;
+
+        /* ### oops. but this doesn't handle the copied case, which DOES
+           ### have properties.  */
+        SVN_ERR(svn_wc__node_is_status_added(&added, wc_ctx, local_abspath,
+                                             scratch_pool));
+        if (added)
+          {
+            *props = NULL;
+            return SVN_NO_ERROR;
+          }
+      }
+
+      return svn_error_return(svn_wc_get_pristine_props(props,
+                                                        wc_ctx,
+                                                        local_abspath,
+                                                        result_pool,
+                                                        scratch_pool));
+    }
+
+  /* ### until svn_wc_prop_list2() returns a NULL value for locally-deleted
+     ### nodes, then let's check manually.  */
+  {
+    svn_boolean_t deleted;
+
+    SVN_ERR(svn_wc__node_is_status_deleted(&deleted, wc_ctx, local_abspath,
+                                           scratch_pool));
+    if (deleted)
+      {
+        *props = NULL;
+        return SVN_NO_ERROR;
+      }
+  }
+
+  return svn_error_return(svn_wc_prop_list2(props, wc_ctx, local_abspath,
+                                            result_pool, scratch_pool));
 }
 
 
@@ -539,19 +574,21 @@ pristine_or_working_propval(const svn_st
                             apr_pool_t *result_pool,
                             apr_pool_t *scratch_pool)
 {
-  if (pristine)
-    {
-      apr_hash_t *pristine_props;
+  apr_hash_t *props;
 
-      SVN_ERR(svn_wc_get_prop_diffs2(NULL, &pristine_props, wc_ctx,
-                                    local_abspath, result_pool, scratch_pool));
-      *propval = apr_hash_get(pristine_props, propname, APR_HASH_KEY_STRING);
-    }
-  else  /* get the working revision */
+  *propval = NULL;
+
+  SVN_ERR(pristine_or_working_props(&props, wc_ctx, local_abspath, pristine,
+                                    scratch_pool, scratch_pool));
+  if (props != NULL)
     {
-      SVN_ERR(svn_wc_prop_get2(propval, wc_ctx, local_abspath, propname,
-                               result_pool, scratch_pool));
+      const svn_string_t *value = apr_hash_get(props,
+                                               propname, APR_HASH_KEY_STRING);
+      if (value)
+        *propval = svn_string_dup(value, result_pool);
     }
+  /* ### should we throw an error if this node is defined to have
+     ### no properties? (ie. props==NULL)  */
 
   return SVN_NO_ERROR;
 }
@@ -1109,37 +1146,21 @@ proplist_walk_cb(const char *local_abspa
                  apr_pool_t *scratch_pool)
 {
   struct proplist_walk_baton *wb = walk_baton;
-  apr_hash_t *hash;
+  apr_hash_t *props;
   const char *path;
 
-  /* Ignore the entry if it does not exist at the time of interest. */
-  if (wb->pristine)
-    {
-      svn_boolean_t added;
-
-      SVN_ERR(svn_wc__node_is_status_added(&added, wb->wc_ctx, local_abspath,
-                                           scratch_pool));
-      if (added)
-        return SVN_NO_ERROR;
-    }
-  else
-    {
-      svn_boolean_t deleted;
-
-      SVN_ERR(svn_wc__node_is_status_deleted(&deleted, wb->wc_ctx,
-                                             local_abspath, scratch_pool));
-      if (deleted)
-        return SVN_NO_ERROR;
-    }
-
   /* If our entry doesn't pass changelist filtering, get outta here. */
   if (! svn_wc__changelist_match(wb->wc_ctx, local_abspath,
                                  wb->changelist_hash, scratch_pool))
     return SVN_NO_ERROR;
 
-  SVN_ERR(pristine_or_working_props(&hash, wb->wc_ctx, local_abspath,
+  SVN_ERR(pristine_or_working_props(&props, wb->wc_ctx, local_abspath,
                                     wb->pristine, scratch_pool, scratch_pool));
 
+  /* Bail if this node is defined to have no properties.  */
+  if (props == NULL)
+    return SVN_NO_ERROR;
+
   if (wb->anchor && wb->anchor_abspath)
     {
       path = svn_dirent_join(wb->anchor,
@@ -1150,7 +1171,7 @@ proplist_walk_cb(const char *local_abspa
   else
     path = local_abspath;
 
-  return call_receiver(path, hash, wb->receiver, wb->receiver_baton,
+  return call_receiver(path, props, wb->receiver, wb->receiver_baton,
                        scratch_pool);
 }
 

Modified: subversion/trunk/subversion/tests/cmdline/prop_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/prop_tests.py?rev=935719&r1=935718&r2=935719&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/prop_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/prop_tests.py Mon Apr 19 20:02:15 2010
@@ -1763,11 +1763,21 @@ def rm_of_replaced_file(sbox):
   svntest.tree.compare_trees("disk", actual_disk_tree,
                              expected_disk.old_tree())
 
-  # Remove the copy. Properties should go back to mu's original props.
+  # Remove the copy. This should leave the original locally-deleted mu,
+  # which should have no properties.
   svntest.main.run_svn(None, 'rm', '--force', mu_path)
 
   exit_code, output, errput = svntest.main.run_svn(None,
                                                    'proplist', '-v', mu_path)
+  if output or errput:
+    raise svntest.Failure('no output/errors expected')
+  svntest.verify.verify_exit_code(None, exit_code, 0)
+
+  # Run it again, but ask for the pristine properties, which should
+  # be mu's original props.
+  exit_code, output, errput = svntest.main.run_svn(None,
+                                                   'proplist', '-v',
+                                                   mu_path + '@base')
   expected_output = svntest.verify.UnorderedRegexOutput([
       'Properties on',
       '  yellow',