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

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

Author: pburba
Date: Wed Feb 10 03:06:16 2010
New Revision: 908335

URL: http://svn.apache.org/viewvc?rev=908335&view=rev
Log:
Follow-up to r880029 and 879831, fix completely broken code for detecting
inoperative subtree merges.

* subversion/libsvn_client/merge.c

  (log_noop_baton_t): Add a new member to store the merge source.

  (log_noop_revs): Remove unnecessary variable and unnecessary check for
   an absolute path.  Use the new log_noop_baton_t member to *actually* 
   calculate the relative path (of the path affected) to the merge
   source, rather than always calculating the empty path and thus always
   finding the log entry as not merged (as we did in r880029) or
   occasionally finding the right answer in some simple cases (as we did
   in the absurdly naïve implementation of r879831).

  (remove_noop_subtree_ranges): Make clear in doc string this is only
   intended to work with forward merges.  Populate the new log_noop_baton_t
   member.

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=908335&r1=908334&r2=908335&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Wed Feb 10 03:06:16 2010
@@ -7212,6 +7212,10 @@
   /* Absolute repository path of MERGE_B->TARGET_ABSPATH. */
   const char *target_repos_abs;
 
+  /* Absolute repository path of younger of the two merge sources
+     being diffed. */
+  const char *source_repos_abs;
+
   /* Initially empty rangelists allocated in POOL. */
   apr_array_header_t *operative_ranges;
   apr_array_header_t *merged_ranges;
@@ -7257,20 +7261,17 @@
   for (hi = apr_hash_first(pool, log_entry->changed_paths2);
        hi;
        hi = apr_hash_next(hi))
-  {
-      const char *log_path = svn_apr_hash_index_key(hi);
-      const char *path = log_path;
+    {
+      const char *path = svn_apr_hash_index_key(hi);
       const char *rel_path;
       const char *cwmi_path;
       apr_array_header_t *paths_explicit_rangelist = NULL;
       svn_boolean_t mergeinfo_inherited = FALSE;
 
-      /* Adjust REL_PATH so it is relative to the top most directory. */
-      rel_path = svn_uri_skip_ancestor(log_path, path);
-
-      if (rel_path[0] == '/') /* Remove any leading '/'. */
-        rel_path++;
-
+      /* Adjust REL_PATH so it is relative to the merge source then use it to
+         calculate what path in the merge target would be affected by this
+         revision. */
+      rel_path = svn_uri_skip_ancestor(log_gap_baton->source_repos_abs, path);
       cwmi_path = svn_dirent_join(log_gap_baton->merge_b->target_abspath,
                                   rel_path, pool);
 
@@ -7348,8 +7349,7 @@
 
    URL1, REVISION1, URL2, REVISION2, NOTIFY_B, and MERGE_B are
    cascaded from the arguments of the same name in do_directory_merge().
-   RA_SESSION is the session for the younger of URL1@REVISION1 and
-   URL2@REVISION2.
+   RA_SESSION is the session for URL2@REVISION2.
 
    Find all the ranges required by subtrees in
    NOTIFY_B->CHILDREN_WITH_MERGEINFO that are *not* required by
@@ -7359,7 +7359,7 @@
    these ranges from all of the subtree's REMAINING_RANGES.
 
    This function should only be called when honoring mergeinfo during
-   forward merges.
+   forward merges (i.e. REVISION1 < REVSION2).
 */
 static svn_error_t *
 remove_noop_subtree_ranges(const char *url1,
@@ -7470,6 +7470,10 @@
                     &(log_gap_baton.target_repos_abs), merge_b->ctx->wc_ctx,
                     merge_b->target_abspath, repos_root_url, TRUE, NULL,
                     result_pool, scratch_pool));
+  SVN_ERR(svn_client__path_relative_to_root(
+                    &(log_gap_baton.source_repos_abs), merge_b->ctx->wc_ctx,
+                    url2, repos_root_url, TRUE, NULL,
+                    result_pool, scratch_pool));
   log_gap_baton.merged_ranges = merged_ranges;
   log_gap_baton.operative_ranges = operative_ranges;
   log_gap_baton.pool = scratch_pool;