Author: philip
Date: Mon May 10 16:00:53 2010
New Revision: 942802

URL: http://svn.apache.org/viewvc?rev=942802&view=rev
Log:
More svn_wc_entry_t removal.  This changes the commit notification in
some cases, but the new notification seems more consistent with the
changes made in the repository.

* subversion/libsvn_client/commit_util.c
  (harvest_committables): Use wc-ng calls instead of entry->revision.

* subversion/tests/cmdline/merge_tests.py
  (merge_dir_and_file_replace): Tweak expected commit output, do some
   extra post-commit verification.

Modified:
    subversion/trunk/subversion/libsvn_client/commit_util.c
    subversion/trunk/subversion/tests/cmdline/merge_tests.py

Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=942802&r1=942801&r2=942802&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Mon May 10 16:00:53 
2010
@@ -383,7 +383,7 @@ harvest_committables(apr_hash_t *committ
   const char *entry_url;
   const char *entry_lock_token;
   const char *cf_url = NULL;
-  svn_revnum_t cf_rev = SVN_INVALID_REVNUM;
+  svn_revnum_t entry_rev, cf_rev = SVN_INVALID_REVNUM;
   const svn_string_t *propval;
   svn_boolean_t is_special;
   svn_boolean_t is_file_external;
@@ -583,14 +583,42 @@ harvest_committables(apr_hash_t *committ
           state_flags |= SVN_CLIENT_COMMIT_ITEM_ADD;
           adds_only = TRUE;
         }
+      else
+        {
+          /* ### svn_wc__node_get_copyfrom_info has pre-wc-ng
+             behaviour for is_copy_target.  That's wrong in this case
+             so lets fix it. */
+          const char *parent_copyfrom_url;
+          svn_revnum_t parent_copyfrom_rev;
+          const char *parent_abspath = svn_dirent_dirname(local_abspath,
+                                                          scratch_pool);
+
+          SVN_ERR(svn_wc__node_get_copyfrom_info(&parent_copyfrom_url,
+                                                 &parent_copyfrom_rev,
+                                                 NULL,
+                                                 ctx->wc_ctx, parent_abspath,
+                                                 scratch_pool, scratch_pool));
+          if (parent_copyfrom_rev != node_copyfrom_rev)
+            {
+              state_flags |= SVN_CLIENT_COMMIT_ITEM_ADD;
+              state_flags |= SVN_CLIENT_COMMIT_ITEM_IS_COPY;
+              cf_url = node_copyfrom_url;
+              cf_rev = node_copyfrom_rev;
+              adds_only = FALSE;
+            }
+        }
     }
 
+  SVN_ERR(svn_wc__node_get_base_rev(&entry_rev, ctx->wc_ctx, local_abspath,
+                                    scratch_pool));
+
   /* Check for the copied-subtree addition case.  */
   if ((entry->copied || copy_mode)
       && (! entry->deleted)
-      && (entry->schedule == svn_wc_schedule_normal))
+      && (entry->schedule == svn_wc_schedule_normal)
+      && (entry_rev != SVN_INVALID_REVNUM))
     {
-      svn_revnum_t p_rev = entry->revision - 1; /* arbitrary non-equal value */
+      svn_revnum_t p_rev = entry_rev - 1; /* arbitrary non-equal value */
       svn_boolean_t wc_root = FALSE;
 
       /* If this is not a WC root then its parent's revision is
@@ -600,7 +628,10 @@ harvest_committables(apr_hash_t *committ
       if (! wc_root)
         {
           if (parent_entry)
-            p_rev = parent_entry->revision;
+            SVN_ERR(svn_wc__node_get_base_rev(&p_rev, ctx->wc_ctx,
+                                              svn_dirent_dirname(local_abspath,
+                                                                 scratch_pool),
+                                              scratch_pool));
         }
       else if (! copy_mode)
         return svn_error_createf
@@ -610,12 +641,12 @@ harvest_committables(apr_hash_t *committ
 
       /* If the ENTRY's revision differs from that of its parent, we
          have to explicitly commit ENTRY as a copy. */
-      if (entry->revision != p_rev)
+      if (entry_rev != p_rev)
         {
           state_flags |= SVN_CLIENT_COMMIT_ITEM_ADD;
           state_flags |= SVN_CLIENT_COMMIT_ITEM_IS_COPY;
           adds_only = FALSE;
-          cf_rev = entry->revision;
+          cf_rev = entry_rev;
           if (copy_mode)
             cf_url = entry_url;
           else if (copyfrom_url)
@@ -716,7 +747,7 @@ harvest_committables(apr_hash_t *committ
         {
           /* Finally, add the committable item. */
           SVN_ERR(add_committable(committables, local_abspath, db_kind, url,
-                                  entry->revision,
+                                  entry_rev,
                                   cf_url,
                                   cf_rev,
                                   state_flags));

Modified: subversion/trunk/subversion/tests/cmdline/merge_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/merge_tests.py?rev=942802&r1=942801&r2=942802&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/merge_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/merge_tests.py Mon May 10 
16:00:53 2010
@@ -3009,7 +3009,6 @@ def merge_dir_and_file_replace(sbox):
   expected_output = svntest.wc.State(wc_dir, {
     'A/C'                    : Item(verb='Sending'),
     'A/C/foo'                : Item(verb='Replacing'),
-    'A/C/foo/bar'            : Item(verb='Adding'),
     })
 
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
@@ -3029,6 +3028,16 @@ def merge_dir_and_file_replace(sbox):
                                         expected_status,
                                         None, wc_dir)
 
+  # Confirm the files are present in the repository.
+  new_file_2_url = sbox.repo_url + '/A/C/foo/new file 2'
+  svntest.actions.run_and_verify_svn(None, ["New text in new file 2.\n"],
+                                     [], 'cat',
+                                     new_file_2_url)
+  new_file_3_url = sbox.repo_url + '/A/C/foo/bar/new file 3'
+  svntest.actions.run_and_verify_svn(None, ["Initial text in new file 3.\n"],
+                                     [], 'cat',
+                                     new_file_3_url)
+
 #----------------------------------------------------------------------
 def merge_file_with_space_in_its_name(sbox):
   "merge a file whose name contains a space"


Reply via email to