You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2011/10/25 17:37:43 UTC

svn commit: r1188722 [2/2] - in /subversion/branches/showing-merge-info: ./ build/generator/ build/generator/templates/ subversion/include/ subversion/include/private/ subversion/libsvn_client/ subversion/libsvn_delta/ subversion/libsvn_fs/ subversion/...

Modified: subversion/branches/showing-merge-info/subversion/libsvn_repos/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/libsvn_repos/log.c?rev=1188722&r1=1188721&r2=1188722&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/libsvn_repos/log.c (original)
+++ subversion/branches/showing-merge-info/subversion/libsvn_repos/log.c Tue Oct 25 15:37:42 2011
@@ -794,8 +794,9 @@ get_combined_mergeinfo_changes(svn_merge
       const char *prev_path;
       svn_revnum_t appeared_rev, prev_rev;
       svn_fs_root_t *prev_root;
-      svn_mergeinfo_catalog_t catalog;
-      svn_mergeinfo_t prev_mergeinfo, mergeinfo, deleted, added;
+      svn_mergeinfo_catalog_t catalog, inherited_catalog;
+      svn_mergeinfo_t prev_mergeinfo, mergeinfo, deleted, added,
+        prev_inherited_mergeinfo, inherited_mergeinfo;
       apr_array_header_t *query_paths;
 
       svn_pool_clear(iterpool);
@@ -845,18 +846,57 @@ get_combined_mergeinfo_changes(svn_merge
           continue;
         }
       SVN_ERR(err);
+
+      /* Issue #4022 'svn log -g interprets change in inherited mergeinfo due
+         to move as a merge': A copy where the source and destination inherit
+         mergeinfo from the same parent means the inherited mergeinfo of the
+         source and destination will differ, but this diffrence is not
+         indicative of a merge unless the mergeinfo on the inherited parent
+         has actually changed.
+
+         To check for this we must fetch the "raw" previous inherited
+         mergeinfo and the "raw" mergeinfo @REV then compare these. */
+      SVN_ERR(svn_fs_get_mergeinfo2(&inherited_catalog, prev_root, query_paths,
+                                    svn_mergeinfo_nearest_ancestor, FALSE,
+                                    FALSE, /* adjust_inherited_mergeinfo */
+                                    iterpool, iterpool));
+
       prev_mergeinfo = apr_hash_get(catalog, prev_path, APR_HASH_KEY_STRING);
+      prev_inherited_mergeinfo = apr_hash_get(inherited_catalog, prev_path, APR_HASH_KEY_STRING);
 
       /* Fetch the current mergeinfo (as of REV, and including
          inherited stuff) for this path. */
       APR_ARRAY_IDX(query_paths, 0, const char *) = path;
       SVN_ERR(svn_fs_get_mergeinfo(&catalog, root, query_paths,
                                    svn_mergeinfo_inherited, FALSE, iterpool));
+
+      /* Issue #4022 again, fetch the raw inherited mergeinfo. */
+      SVN_ERR(svn_fs_get_mergeinfo2(&inherited_catalog, root, query_paths,
+                                    svn_mergeinfo_nearest_ancestor, FALSE,
+                                    FALSE, /* adjust_inherited_mergeinfo */
+                                    iterpool, iterpool));
+
       mergeinfo = apr_hash_get(catalog, path, APR_HASH_KEY_STRING);
+      inherited_mergeinfo = apr_hash_get(inherited_catalog, path, APR_HASH_KEY_STRING);
 
       if (!prev_mergeinfo && !mergeinfo)
         continue;
 
+      /* Last bit of issue #4022 checking. */
+      if (prev_inherited_mergeinfo && inherited_mergeinfo)
+        {
+          svn_boolean_t inherits_same_mergeinfo;
+
+          SVN_ERR(svn_mergeinfo__equals(&inherits_same_mergeinfo,
+                                        prev_inherited_mergeinfo,
+                                        inherited_mergeinfo,
+                                        TRUE, iterpool));
+          /* If a copy rather than an actual merge brought about an
+             inherited mergeinfo change then we are finished. */
+          if (inherits_same_mergeinfo)
+            continue;
+        }
+
       /* Compare, constrast, and combine the results. */
       SVN_ERR(svn_mergeinfo_diff2(&deleted, &added, prev_mergeinfo,
                                   mergeinfo, FALSE, result_pool, iterpool));
@@ -885,7 +925,7 @@ get_combined_mergeinfo_changes(svn_merge
       for (i = 0; i < paths->nelts; i++)
         {
           const char *path = APR_ARRAY_IDX(paths, i, const char *);
-          if (! svn_dirent_is_ancestor(path, changed_path))
+          if (! svn_fspath__is_ancestor(path, changed_path))
             continue;
           svn_pool_clear(iterpool);
           deleted = apr_hash_get(deleted_mergeinfo_catalog, key, klen);

Modified: subversion/branches/showing-merge-info/subversion/libsvn_subr/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/libsvn_subr/mergeinfo.c?rev=1188722&r1=1188721&r2=1188722&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/libsvn_subr/mergeinfo.c (original)
+++ subversion/branches/showing-merge-info/subversion/libsvn_subr/mergeinfo.c Tue Oct 25 15:37:42 2011
@@ -2178,6 +2178,36 @@ svn_mergeinfo__add_prefix_to_catalog(svn
 }
 
 svn_error_t *
+svn_mergeinfo__relpaths_to_urls(apr_hash_t **out_mergeinfo,
+                                svn_mergeinfo_t mergeinfo,
+                                const char *repos_root_url,
+                                apr_pool_t *result_pool,
+                                apr_pool_t *scratch_pool)
+{
+  *out_mergeinfo = NULL;
+  if (mergeinfo)
+    {
+      apr_hash_index_t *hi;
+      apr_hash_t *full_path_mergeinfo = apr_hash_make(result_pool);
+
+      for (hi = apr_hash_first(scratch_pool, mergeinfo);
+           hi; hi = apr_hash_next(hi))
+        {
+          const char *key = svn__apr_hash_index_key(hi);
+          void *val = svn__apr_hash_index_val(hi);
+
+          apr_hash_set(full_path_mergeinfo,
+                       svn_path_url_add_component2(repos_root_url, key + 1,
+                                                   result_pool),
+                       APR_HASH_KEY_STRING, val);
+        }
+      *out_mergeinfo = full_path_mergeinfo;
+    }
+
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
 svn_mergeinfo__add_suffix_to_mergeinfo(svn_mergeinfo_t *out_mergeinfo,
                                        svn_mergeinfo_t mergeinfo,
                                        const char *suffix_relpath,
@@ -2194,13 +2224,13 @@ svn_mergeinfo__add_suffix_to_mergeinfo(s
        hi;
        hi = apr_hash_next(hi))
     {
-      const char *path = svn__apr_hash_index_key(hi);
+      const char *fspath = svn__apr_hash_index_key(hi);
       apr_array_header_t *rangelist = svn__apr_hash_index_val(hi);
 
       apr_hash_set(*out_mergeinfo,
-                   svn_dirent_join(path, suffix_relpath, result_pool),
+                   svn_fspath__join(fspath, suffix_relpath, result_pool),
                    APR_HASH_KEY_STRING,
-                   svn_rangelist_dup(rangelist, result_pool));
+                   rangelist);
     }
 
   return SVN_NO_ERROR;

Modified: subversion/branches/showing-merge-info/subversion/libsvn_wc/diff_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/libsvn_wc/diff_editor.c?rev=1188722&r1=1188721&r2=1188722&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/libsvn_wc/diff_editor.c (original)
+++ subversion/branches/showing-merge-info/subversion/libsvn_wc/diff_editor.c Tue Oct 25 15:37:42 2011
@@ -1880,6 +1880,8 @@ svn_wc_get_diff_editor6(const svn_delta_
   void *inner_baton;
   svn_delta_editor_t *tree_editor;
   const svn_delta_editor_t *inner_editor;
+  svn_delta_shim_callbacks_t *shim_callbacks =
+                                svn_delta_shim_callbacks_default(result_pool);
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(anchor_abspath));
 
@@ -1932,8 +1934,7 @@ svn_wc_get_diff_editor6(const svn_delta_
                                             result_pool));
 
   SVN_ERR(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton,
-                                   NULL, NULL, NULL, NULL,
-                                   result_pool, scratch_pool));
+                                   shim_callbacks, result_pool, scratch_pool));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/showing-merge-info/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/libsvn_wc/status.c?rev=1188722&r1=1188721&r2=1188722&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/libsvn_wc/status.c (original)
+++ subversion/branches/showing-merge-info/subversion/libsvn_wc/status.c Tue Oct 25 15:37:42 2011
@@ -2456,6 +2456,8 @@ svn_wc_get_status_editor5(const svn_delt
   svn_delta_editor_t *tree_editor = svn_delta_default_editor(result_pool);
   void *inner_baton;
   const svn_delta_editor_t *inner_editor;
+  svn_delta_shim_callbacks_t *shim_callbacks =
+                                svn_delta_shim_callbacks_default(result_pool);
 
   /* Construct an edit baton. */
   eb = apr_pcalloc(result_pool, sizeof(*eb));
@@ -2544,7 +2546,7 @@ svn_wc_get_status_editor5(const svn_delt
     *set_locks_baton = eb;
 
   SVN_ERR(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton,
-                                   NULL, NULL, NULL, NULL,
+                                   shim_callbacks,
                                    result_pool, scratch_pool));
 
   return SVN_NO_ERROR;

Modified: subversion/branches/showing-merge-info/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/libsvn_wc/update_editor.c?rev=1188722&r1=1188721&r2=1188722&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/branches/showing-merge-info/subversion/libsvn_wc/update_editor.c Tue Oct 25 15:37:42 2011
@@ -4806,6 +4806,8 @@ make_editor(svn_revnum_t *target_revisio
   const svn_delta_editor_t *inner_editor;
   const char *repos_root, *repos_uuid;
   struct fetch_baton *fpb;
+  svn_delta_shim_callbacks_t *shim_callbacks =
+                                svn_delta_shim_callbacks_default(edit_pool);
 
   /* An unknown depth can't be sticky. */
   if (depth == svn_depth_unknown)
@@ -5036,9 +5038,14 @@ make_editor(svn_revnum_t *target_revisio
   fpb = apr_palloc(result_pool, sizeof(*fpb));
   fpb->db = db;
   fpb->target_abspath = eb->target_abspath;
+
+  shim_callbacks->fetch_kind_func = fetch_kind_func;
+  shim_callbacks->fetch_kind_baton = fpb;
+  shim_callbacks->fetch_props_func = fetch_props_func;
+  shim_callbacks->fetch_props_baton = fpb;
+
   SVN_ERR(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton,
-                                   fetch_props_func, fpb, fetch_kind_func, fpb,
-                                   result_pool, scratch_pool));
+                                   shim_callbacks, result_pool, scratch_pool));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/showing-merge-info/subversion/svnrdump/dump_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/svnrdump/dump_editor.c?rev=1188722&r1=1188721&r2=1188722&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/svnrdump/dump_editor.c (original)
+++ subversion/branches/showing-merge-info/subversion/svnrdump/dump_editor.c Tue Oct 25 15:37:42 2011
@@ -856,6 +856,8 @@ svn_rdump__get_dump_editor(const svn_del
 {
   struct dump_edit_baton *eb;
   svn_delta_editor_t *de;
+  svn_delta_shim_callbacks_t *shim_callbacks =
+                                        svn_delta_shim_callbacks_default(pool);
 
   eb = apr_pcalloc(pool, sizeof(struct dump_edit_baton));
   eb->stream = stream;
@@ -892,7 +894,7 @@ svn_rdump__get_dump_editor(const svn_del
                                             de, eb, editor, edit_baton, pool));
 
   SVN_ERR(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton,
-                                   NULL, NULL, NULL, NULL, pool, pool));
+                                   shim_callbacks, pool, pool));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/showing-merge-info/subversion/svnsync/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/svnsync/main.c?rev=1188722&r1=1188721&r2=1188722&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/svnsync/main.c (original)
+++ subversion/branches/showing-merge-info/subversion/svnsync/main.c Tue Oct 25 15:37:42 2011
@@ -1051,6 +1051,8 @@ replay_rev_started(svn_revnum_t revision
   apr_hash_t *filtered;
   int filtered_count;
   int normalized_count;
+  svn_delta_shim_callbacks_t *shim_callbacks =
+                                    svn_delta_shim_callbacks_default(pool);
 
   /* We set this property so that if we error out for some reason
      we can later determine where we were in the process of
@@ -1119,7 +1121,7 @@ replay_rev_started(svn_revnum_t revision
   *edit_baton = cancel_baton;
 
   SVN_ERR(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton,
-                                   NULL, NULL, NULL, NULL, pool, pool));
+                                   shim_callbacks, pool, pool));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/showing-merge-info/subversion/tests/cmdline/log_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/tests/cmdline/log_tests.py?rev=1188722&r1=1188721&r2=1188722&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/tests/cmdline/log_tests.py (original)
+++ subversion/branches/showing-merge-info/subversion/tests/cmdline/log_tests.py Tue Oct 25 15:37:42 2011
@@ -2032,7 +2032,6 @@ def log_on_nonexistent_path_and_valid_re
 # Test for issue #4022 'svn log -g interprets change in inherited mergeinfo
 # due to move as a merge'.
 @Issue(4022)
-@XFail()
 def merge_sensitive_log_copied_path_inherited_mergeinfo(sbox):
   "log -g on copied path with inherited mergeinfo"
 
@@ -2060,8 +2059,8 @@ def merge_sensitive_log_copied_path_inhe
   svntest.main.run_svn(None, 'ci', '-m', 'Move file', wc_dir)
 
   # 'svn log -g --stop-on-copy ^/A/C/gamma' hould return *only* r5
-  # Currently this test fails because the change in gamma's inherited
-  # mergeinfo between r4 and r5, due to the move, is understood as a merge:
+  # Previously this test failed because the change in gamma's inherited
+  # mergeinfo between r4 and r5, due to the move, was understood as a merge:
   #
   #   >svn log -v -g --stop-on-copy ^^/A/C/gamma
   #   ------------------------------------------------------------------------

Modified: subversion/branches/showing-merge-info/subversion/tests/libsvn_delta/editor-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/tests/libsvn_delta/editor-test.c?rev=1188722&r1=1188721&r2=1188722&view=diff
==============================================================================
--- subversion/branches/showing-merge-info/subversion/tests/libsvn_delta/editor-test.c (original)
+++ subversion/branches/showing-merge-info/subversion/tests/libsvn_delta/editor-test.c Tue Oct 25 15:37:42 2011
@@ -32,6 +32,14 @@
 
 #include "../svn_test_fs.h"
 
+/* This is kind of unorthodox, but since we're doing some fairly deep testing
+   of the various delta editor/Ev2 compat pieces, we need to just include the
+   compat code directly here.
+   
+   These tests are not static, and may evolve as the implementation of the
+   various shims does. */
+#include "../../libsvn_delta/compat.c"
+
 #define SET_STR(ps, s) ((ps)->data = (s), (ps)->len = strlen(s))
 
 /* We use svn_repos APIs in some of these tests simply for convenience. */
@@ -266,8 +274,8 @@ editor_from_delta_editor_test(const svn_
 
       /* Construct our editor, and from it a delta editor. */
       SVN_ERR(get_noop_editor(&editor, NULL, NULL, NULL, iterpool, iterpool));
-      SVN_ERR(svn_delta_from_editor(&deditor, &dedit_baton, editor,
-                                    NULL, NULL, iterpool));
+      SVN_ERR(delta_from_editor(&deditor, &dedit_baton, editor,
+                                NULL, NULL, iterpool));
 
       SVN_ERR(svn_repos_replay2(revision_root, "", SVN_INVALID_REVNUM, TRUE,
                                 deditor, dedit_baton, NULL, NULL, iterpool));