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/04/29 02:49:16 UTC

svn commit: r939150 - /subversion/trunk/subversion/libsvn_client/merge.c

Author: neels
Date: Thu Apr 29 00:49:16 2010
New Revision: 939150

URL: http://svn.apache.org/viewvc?rev=939150&view=rev
Log:
Another entry_t down.

* subversion/libsvn_client/merge.c
  (obstructed_or_missing):
    Use wc-ng API instead of svn_wc__get_entry_versioned(), and much simplify
    this function in the process. Untangle, rinse and dry.
  (node_kind_working, node_kind_on_disk):
    Remove these ghastly two functions and incorporate into
    obstructed_or_missing(), the way it should always have been.

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

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=939150&r1=939149&r2=939150&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Thu Apr 29 00:49:16 2010
@@ -367,57 +367,11 @@ is_path_conflicted_by_merge(merge_cmd_ba
           apr_hash_count(merge_b->conflicted_paths) > 0);
 }
 
-/* Return the node kind of the working version of local path PATH,
- * according to the WC metadata in ENTRY. If ENTRY is null, assume the node
- * is unversioned and so set the kind to 'none'.
- *
- * However, if this is a dry run, set *NODE_KIND to 'none' if the node would
- * already have been deleted by the merge if this were not a dry run. Use
- * MERGE_B to determine the dry-run details. */
-static svn_node_kind_t
-node_kind_working(const char *path,
-                  const merge_cmd_baton_t *merge_b,
-                  const svn_wc_entry_t *entry)
-{
-  if (!entry
-      || (entry->schedule == svn_wc_schedule_delete)
-      || (merge_b->dry_run && dry_run_deleted_p(merge_b, path))
-      || (entry->deleted && entry->schedule != svn_wc_schedule_add))
-    return svn_node_none;
-  else
-    return entry->kind;
-}
-
-/* Return the node kind that is found on disk at local path PATH.
- *
- * However, if this is a dry run, set *NODE_KIND to 'none' if the node would
- * already have been deleted by the merge if this were not a dry run. Use
- * MERGE_B to determine the dry-run details. */
-static svn_node_kind_t
-node_kind_on_disk(const char *path,
-                  const merge_cmd_baton_t *merge_b,
-                  apr_pool_t *pool)
-{
-  svn_error_t *err;
-  svn_node_kind_t node_kind;
-
-  err = svn_io_check_path(path, &node_kind, pool);
-  if (err)
-    {
-      svn_error_clear(err);
-      return svn_node_unknown;
-    }
-  else if (dry_run_deleted_p(merge_b, path))
-    return svn_node_none;
-  else
-    return node_kind;
-}
-
-/* Return a state indicating whether the WC metadata in ENTRY matches the
- * node kind on disk of the local path PATH. If ENTRY is null, assume the
- * node is unversioned. In the case of a dry-run merge, use the disk node
- * kind that would exist if it were not a dry run. Use MERGE_B to determine
- * the dry-run details.
+/* Return a state indicating whether the WC metadata matches the
+ * node kind on disk of the local path PATH.
+ * Use MERGE_B to determine the dry-run details; particularly, if a dry run
+ * noted that it deleted this path, assume matching node kinds (as if both
+ * kinds were svn_node_none).
  *
  *   - Return svn_wc_notify_state_inapplicable if the node kind matches.
  *   - Return 'obstructed' if there is a node on disk where none or a
@@ -430,55 +384,52 @@ obstructed_or_missing(const char *path,
                       apr_pool_t *pool)
 {
   svn_error_t *err;
-  const svn_wc_entry_t *entry = NULL;
-  svn_node_kind_t kind_expected, kind_on_disk, wc_kind;
+  svn_node_kind_t kind_expected, kind_on_disk;
   const char *local_abspath;
 
+  /* In a dry run, make as if nodes "deleted" by the dry run appear so. */
+  if (merge_b->dry_run && dry_run_deleted_p(merge_b, path))
+    return svn_wc_notify_state_inapplicable;
+
+  /* Since this function returns no svn_error_t, we make all errors look like
+   * no node found in the wc. */
   err = svn_dirent_get_absolute(&local_abspath, path, pool);
 
   if (!err)
-    err = svn_wc_read_kind(&wc_kind, merge_b->ctx->wc_ctx, local_abspath,
-                           FALSE, pool);
+    err = svn_wc_read_kind(&kind_expected, merge_b->ctx->wc_ctx,
+                           local_abspath, FALSE, pool);
 
   if (err)
     {
-      wc_kind = svn_node_none;
       svn_error_clear(err);
-      entry = NULL;
+      kind_expected = svn_node_none;
     }
-  else
-    {
-      err = svn_wc__get_entry_versioned(&entry, merge_b->ctx->wc_ctx,
-                                        local_abspath, svn_node_unknown,
-                                        TRUE, FALSE, pool, pool);
 
+  /* If a node is deleted, we will still get its kind from the working copy.
+   * But to compare with disk state, we want to consider deleted nodes as
+   * svn_node_none instead of their original kind.
+   * ### Not necessary with central DB:
+   * Because deleted directories are expected to remain on disk until commit
+   * to keep the metadata available, we only do this for files, not dirs. */
+  if (kind_expected == svn_node_file)
+    {
+      svn_boolean_t is_deleted;
+      err = svn_wc__node_is_status_deleted(&is_deleted,
+                                           merge_b->ctx->wc_ctx,
+                                           local_abspath,
+                                           pool);
       if (err)
-        {
-          svn_error_clear(err);
-          entry = NULL;
-        }
+        svn_error_clear(err);
+      else if (is_deleted)
+        kind_expected = svn_node_none;
     }
 
-  if ((wc_kind == svn_node_dir || wc_kind == svn_node_file)
-      && !entry)
-    return svn_wc_notify_state_missing;
-
-  /* ### This check (and most of this function)
-         can be removed after we move to one DB */
-  /* svn_wc__get_entry_versioned ignores node kind errors, so check if we
-     didn't get the parent stub, instead of the real thing */
-  if (entry && entry->kind == svn_node_dir && *entry->name != '\0')
-    return svn_wc_notify_state_missing; /* Only found parent entry */
-
-  kind_expected = node_kind_working(path, merge_b, entry);
-  kind_on_disk = node_kind_on_disk(path, merge_b, pool);
-
-  /* If it's a sched-delete directory, change the expected kind to "dir"
-   * because the directory should not yet have gone from disk. */
-  if (entry && entry->kind == svn_node_dir
-      && entry->schedule == svn_wc_schedule_delete
-      && kind_on_disk == svn_node_dir)
-    kind_expected = svn_node_dir;
+  err = svn_io_check_path(path, &kind_on_disk, pool);
+  if (err)
+    {
+      svn_error_clear(err);
+      kind_on_disk = svn_node_unknown;
+    }
 
   if (kind_expected == kind_on_disk)
     return svn_wc_notify_state_inapplicable;



Re: svn commit: r939150 - /subversion/trunk/subversion/libsvn_client/merge.c

Posted by Neels J Hofmeyr <ne...@elego.de>.
Philip Martin wrote:
> Neels J Hofmeyr <ne...@elego.de> writes:
> 
>>> (Nice effect is that you can check excluded on ra_local, but can't
>>> check absent)
>> /me doesn't fully understand and wonders if he should.
> 
> Absent can only occur with auth and auth does not apply to ra_local.

Heh, something I always knew but never realized. Thanks!
~Neels


Re: svn commit: r939150 - /subversion/trunk/subversion/libsvn_client/merge.c

Posted by Philip Martin <ph...@wandisco.com>.
Neels J Hofmeyr <ne...@elego.de> writes:

>> (Nice effect is that you can check excluded on ra_local, but can't
>> check absent)
> /me doesn't fully understand and wonders if he should.

Absent can only occur with auth and auth does not apply to ra_local.

-- 
Philip

Re: svn commit: r939150 - /subversion/trunk/subversion/libsvn_client/merge.c

Posted by Neels J Hofmeyr <ne...@elego.de>.
Bert Huijben wrote:
> 
>> -----Original Message-----
>> From: neels@apache.org [mailto:neels@apache.org]
>> Sent: donderdag 29 april 2010 2:49
>> To: commits@subversion.apache.org
>> Subject: svn commit: r939150 -
>> /subversion/trunk/subversion/libsvn_client/merge.c
>>
>> Author: neels
>> Date: Thu Apr 29 00:49:16 2010
>> New Revision: 939150
>>
>> URL: http://svn.apache.org/viewvc?rev=939150&view=rev
>> Log:
>> Another entry_t down.
>>
>> * subversion/libsvn_client/merge.c
>>   (obstructed_or_missing):
>>     Use wc-ng API instead of svn_wc__get_entry_versioned(), and much
>> simplify
>>     this function in the process. Untangle, rinse and dry.
>>   (node_kind_working, node_kind_on_disk):
>>     Remove these ghastly two functions and incorporate into
>>     obstructed_or_missing(), the way it should always have been.
> 
> This patch breaks
> FAIL:  merge_authz_tests.py 1: skipped paths get overriding mergeinfo

weird...
> (which is automatically skipped on ra_local)
...ah! Darn it!

Thanks Bert, I'll try to resolve.

> Most likely your new check doesn't work correctly for 'absent' nodes.
thx
> I would recommend also checking the behavior for excluded node, as our test suite doesn't test those as often as it should.
and thx

> (Nice effect is that you can check excluded on ra_local, but can't check absent)
/me doesn't fully understand and wonders if he should.

~Neels



RE: svn commit: r939150 - /subversion/trunk/subversion/libsvn_client/merge.c

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: neels@apache.org [mailto:neels@apache.org]
> Sent: donderdag 29 april 2010 2:49
> To: commits@subversion.apache.org
> Subject: svn commit: r939150 -
> /subversion/trunk/subversion/libsvn_client/merge.c
> 
> Author: neels
> Date: Thu Apr 29 00:49:16 2010
> New Revision: 939150
> 
> URL: http://svn.apache.org/viewvc?rev=939150&view=rev
> Log:
> Another entry_t down.
> 
> * subversion/libsvn_client/merge.c
>   (obstructed_or_missing):
>     Use wc-ng API instead of svn_wc__get_entry_versioned(), and much
> simplify
>     this function in the process. Untangle, rinse and dry.
>   (node_kind_working, node_kind_on_disk):
>     Remove these ghastly two functions and incorporate into
>     obstructed_or_missing(), the way it should always have been.

This patch breaks
FAIL:  merge_authz_tests.py 1: skipped paths get overriding mergeinfo
(which is automatically skipped on ra_local)

Most likely your new check doesn't work correctly for 'absent' nodes.
I would recommend also checking the behavior for excluded node, as our test suite doesn't test those as often as it should.
(Nice effect is that you can check excluded on ra_local, but can't check absent)

	Bert