You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ne...@apache.org on 2010/05/05 01:31:42 UTC

svn commit: r941094 - /subversion/trunk/subversion/libsvn_client/commit_util.c

Author: neels
Date: Tue May  4 23:31:42 2010
New Revision: 941094

URL: http://svn.apache.org/viewvc?rev=941094&view=rev
Log:
One less use of entry_t.

* subversion/libsvn_client/commit_util.c
  (harvest_committables):
    Use wc-ng instead of entry->schedule to determine whether a node's base
    needs deletion. Shift some variable declarations to indicate locality to
    their scopes. Another patch should align the duplicate calls to
    svn_wc__node_get_copyfrom_info(). Also rename two of the local vars
    shifted around (lose the "entry_" prefix).

Modified:
    subversion/trunk/subversion/libsvn_client/commit_util.c

Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=941094&r1=941093&r2=941094&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Tue May  4 23:31:42 2010
@@ -383,14 +383,11 @@ harvest_committables(apr_hash_t *committ
   const char *entry_url;
   const char *entry_lock_token;
   const char *cf_url = NULL;
-  const char *entry_copyfrom_url;
-  svn_revnum_t entry_copyfrom_rev;
   svn_revnum_t cf_rev = SVN_INVALID_REVNUM;
   const svn_string_t *propval;
   svn_boolean_t is_special;
   svn_boolean_t is_file_external;
   svn_boolean_t is_added;
-  svn_boolean_t is_copy_target;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
@@ -519,12 +516,42 @@ harvest_committables(apr_hash_t *committ
      - The entry is scheduled for deletion or replacement, which case
        we need to send a delete either way.
   */
-  if ((! adds_only)
-      && ((entry->deleted && entry->schedule == svn_wc_schedule_normal)
-          || (entry->schedule == svn_wc_schedule_delete)
-          || (entry->schedule == svn_wc_schedule_replace)))
+  if (! adds_only)
     {
-      state_flags |= SVN_CLIENT_COMMIT_ITEM_DELETE;
+      svn_boolean_t is_replaced;
+      svn_boolean_t is_status_deleted;
+      svn_boolean_t is_present;
+
+      /* ### There is room for optimization here, but let's keep it plain
+       * while this function is in flux. */
+      SVN_ERR(svn_wc__node_is_status_deleted(&is_status_deleted, ctx->wc_ctx,
+                                             local_abspath, scratch_pool));
+      SVN_ERR(svn_wc__node_is_replaced(&is_replaced, ctx->wc_ctx,
+                                       local_abspath, scratch_pool));
+      SVN_ERR(svn_wc__node_is_status_present(&is_present, ctx->wc_ctx,
+                                             local_abspath, scratch_pool));
+
+      /* ### Catch a mixed-rev copy that replaces. The mixed-rev children are
+       * each regarded as op-roots of the replace and result in currently
+       * unexpected behaviour. Model wc-1 behaviour, seeing only one copy
+       * target at the root of a mixed-rev copy, via
+       * svn_wc__node_get_copyfrom_info(). */
+      if (is_replaced)
+        {
+          const char *is_copy;
+          svn_boolean_t is_copy_target;
+          /* ### TODO: sensibly align this call of get_copyfrom_info() with
+           * the same call below (when checking added nodes). */
+          SVN_ERR(svn_wc__node_get_copyfrom_info(&is_copy, NULL,
+                                                 &is_copy_target, ctx->wc_ctx,
+                                                 local_abspath, scratch_pool,
+                                                 scratch_pool));
+          if (is_copy && ! is_copy_target)
+            is_replaced = FALSE;
+        }
+
+      if (is_status_deleted || is_replaced || ! is_present)
+        state_flags |= SVN_CLIENT_COMMIT_ITEM_DELETE;
     }
 
   /* Check for the trivial addition case.  Adds can be explicit
@@ -534,8 +561,12 @@ harvest_committables(apr_hash_t *committ
                                 scratch_pool));
   if (is_added)
     {
-      SVN_ERR(svn_wc__node_get_copyfrom_info(&entry_copyfrom_url,
-                                             &entry_copyfrom_rev,
+      svn_boolean_t is_copy_target;
+      const char *copyfrom_url;
+      svn_revnum_t copyfrom_rev;
+
+      SVN_ERR(svn_wc__node_get_copyfrom_info(&copyfrom_url,
+                                             &copyfrom_rev,
                                              &is_copy_target,
                                              ctx->wc_ctx, local_abspath,
                                              scratch_pool, scratch_pool));
@@ -543,11 +574,11 @@ harvest_committables(apr_hash_t *committ
         {
           state_flags |= SVN_CLIENT_COMMIT_ITEM_ADD;
           state_flags |= SVN_CLIENT_COMMIT_ITEM_IS_COPY;
-          cf_url = entry_copyfrom_url;
-          cf_rev = entry_copyfrom_rev;
+          cf_url = copyfrom_url;
+          cf_rev = copyfrom_rev;
           adds_only = FALSE;
         }
-      else if (!entry_copyfrom_url)
+      else if (!copyfrom_url)
         {
           state_flags |= SVN_CLIENT_COMMIT_ITEM_ADD;
           adds_only = TRUE;



Re: svn commit: r941094 - /subversion/trunk/subversion/libsvn_client/commit_util.c

Posted by Neels J Hofmeyr <ne...@elego.de>.
On 05/05/2010 10:45 AM, Philip Martin wrote:
> neels@apache.org writes:
> 
>> Author: neels
>> Date: Tue May  4 23:31:42 2010
>> New Revision: 941094
>> URL: http://svn.apache.org/viewvc?rev=941094&view=rev
>> Log:
>> One less use of entry_t.
> 
>>    if (is_added)
>>      {
>> -      SVN_ERR(svn_wc__node_get_copyfrom_info(&entry_copyfrom_url,
>> -                                             &entry_copyfrom_rev,
>> +      svn_boolean_t is_copy_target;
>> +      const char *copyfrom_url;
>> +      svn_revnum_t copyfrom_rev;
>> +
>> +      SVN_ERR(svn_wc__node_get_copyfrom_info(&copyfrom_url,
>> +                                             &copyfrom_rev,
>>                                               &is_copy_target,
>>                                               ctx->wc_ctx, local_abspath,
>>                                               scratch_pool, scratch_pool));
> 
> ../src/subversion/libsvn_client/commit_util.c:565: warning: declaration of ‘copyfrom_url’ shadows a parameter
> ../src/subversion/libsvn_client/commit_util.c:367: warning: shadowed declaration is here

oops, thx!

I want to fix that whole duplicate-get_copyfrom_info thing anyway
(later/soon). That var shadowing shouldn't hurt for now, though, except for
the warning.

~Neels


Re: svn commit: r941094 - /subversion/trunk/subversion/libsvn_client/commit_util.c

Posted by Philip Martin <ph...@wandisco.com>.
neels@apache.org writes:

> Author: neels
> Date: Tue May  4 23:31:42 2010
> New Revision: 941094
> URL: http://svn.apache.org/viewvc?rev=941094&view=rev
> Log:
> One less use of entry_t.

>    if (is_added)
>      {
> -      SVN_ERR(svn_wc__node_get_copyfrom_info(&entry_copyfrom_url,
> -                                             &entry_copyfrom_rev,
> +      svn_boolean_t is_copy_target;
> +      const char *copyfrom_url;
> +      svn_revnum_t copyfrom_rev;
> +
> +      SVN_ERR(svn_wc__node_get_copyfrom_info(&copyfrom_url,
> +                                             &copyfrom_rev,
>                                               &is_copy_target,
>                                               ctx->wc_ctx, local_abspath,
>                                               scratch_pool, scratch_pool));

../src/subversion/libsvn_client/commit_util.c:565: warning: declaration of ‘copyfrom_url’ shadows a parameter
../src/subversion/libsvn_client/commit_util.c:367: warning: shadowed declaration is here

-- 
Philip