You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2016/07/08 15:22:13 UTC

svn commit: r1751923 - /subversion/trunk/subversion/libsvn_client/conflicts.c

Author: stsp
Date: Fri Jul  8 15:22:13 2016
New Revision: 1751923

URL: http://svn.apache.org/viewvc?rev=1751923&view=rev
Log:
Make the conflict resolver take the last-changed revision of the deleted node
into account while mapping a delete+copy pair to a move.

* subversion/libsvn_client/conflicts.c
  (check_move_ancestry): Make sure that a moved-here node's copyfrom revision
   is greater or equal to the moved-away node's last-changed revision.
   If copyfrom-rev < last-changed-rev, we must assume an incoming copy+delete
   operation instead of an incoming move operation.
  (find_moves_in_revision): Remove related TODO comment.

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

Modified: subversion/trunk/subversion/libsvn_client/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/conflicts.c?rev=1751923&r1=1751922&r2=1751923&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_client/conflicts.c Fri Jul  8 15:22:13 2016
@@ -271,9 +271,10 @@ struct repos_move_info {
   apr_array_header_t *next;
 };
 
-/* Set *RELATED to true if the deleted node at repository relpath
- * DELETED_REPOS_RELPATH@DELETED_REV is ancestrally related to the node at
- * repository relpath COPYFROM_PATH@COPYFROM_REV, else set it to false. */
+/* Set *RELATED to true if the deleted node DELETED_REPOS_RELPATH@DELETED_REV
+ * is an ancestor of the copied node COPYFROM_PATH@COPYFROM_REV, and if the
+ * copied node is a copy of the deleted node's last-changed revision's content,
+ * rather than a copy of some older content. */
 static svn_error_t *
 check_move_ancestry(svn_boolean_t *related,
                     const char *repos_root_url,
@@ -290,6 +291,7 @@ check_move_ancestry(svn_boolean_t *relat
   svn_ra_session_t *ra_session;
   const char *corrected_url;
   apr_array_header_t *location_revisions;
+  svn_dirent_t *dirent;
 
   *related = FALSE;
 
@@ -315,9 +317,17 @@ check_move_ancestry(svn_boolean_t *relat
     {
       if (deleted_location[0] == '/')
         deleted_location++;
-      *related = (strcmp(deleted_location, copyfrom_path) == 0);
+      if (strcmp(deleted_location, copyfrom_path) != 0)
+        return SVN_NO_ERROR;
     }
 
+  /* Verify that copyfrom_rev >= last-changed revision of the deleted node. */
+  SVN_ERR(svn_ra_stat(ra_session, "", deleted_rev - 1, &dirent, scratch_pool));
+  if (dirent == NULL || copyfrom_rev < dirent->created_rev)
+    return SVN_NO_ERROR;
+
+  *related = TRUE;
+
   return SVN_NO_ERROR;
 }
 
@@ -387,11 +397,6 @@ find_moves_in_revision(apr_hash_t *moves
           if (!related)
             continue;
 
-          /* ### TODO:
-           * If the node was not copied from the most recent last-changed
-           * revision of the deleted node, this is not a move but a
-           * "copy from the past + delete". */
-
           /* Remember details of this move. */
           move = apr_pcalloc(result_pool, sizeof(*move));
           move->moved_from_repos_relpath = apr_pstrdup(result_pool,