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 2011/08/18 21:14:49 UTC

svn commit: r1159362 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_wc/tree_conflicts.c libsvn_wc/update_editor.c svn/tree-conflicts.c

Author: stsp
Date: Thu Aug 18 19:14:48 2011
New Revision: 1159362

URL: http://svn.apache.org/viewvc?rev=1159362&view=rev
Log:
Record local moves in tree-conflict data, stop recording them as deletes.

This only affects tree conflicts during updates, for now.

* subversion/include/svn_wc.h
  (svn_wc_conflict_reason_t): New values svn_wc_conflict_reason_moved_away
   and svn_wc_conflict_reason_moved_here.

* subversion/svn/tree-conflicts.c
  (map_conflict_reason_human, map_conflict_reason_xml): Add moved-away
   and moved-to.

* subversion/libsvn_wc/update_editor.c
  (create_tree_conflict): Describe conflicts involving moves with moved-away
   and moved-here conflict reasons, instead of describing them as delete/add.
  (delete_entry, open_directory, open_file): Update checks related to
   deleted/added conflict reasons to include the moved-away/moved-here reasons.

* subversion/libsvn_wc/tree_conflicts.c
  (svn_wc__conflict_reason_map): Add moved-here/moved-away.

Modified:
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_wc/tree_conflicts.c
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/svn/tree-conflicts.c

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1159362&r1=1159361&r2=1159362&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Thu Aug 18 19:14:48 2011
@@ -1551,7 +1551,11 @@ typedef enum svn_wc_conflict_reason_t
   /** Object is already added or schedule-add. @since New in 1.6. */
   svn_wc_conflict_reason_added,
   /** Object is already replaced. @since New in 1.7. */
-  svn_wc_conflict_reason_replaced
+  svn_wc_conflict_reason_replaced,
+  /** Object is moved away. @since New in 1.8. */
+  svn_wc_conflict_reason_moved_away,
+  /** Object is moved here. @since New in 1.8. */
+  svn_wc_conflict_reason_moved_here
 
 } svn_wc_conflict_reason_t;
 

Modified: subversion/trunk/subversion/libsvn_wc/tree_conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/tree_conflicts.c?rev=1159362&r1=1159361&r2=1159362&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/tree_conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/tree_conflicts.c Thu Aug 18 19:14:48 2011
@@ -76,6 +76,8 @@ const svn_token_map_t svn_wc__conflict_r
   { "added",       svn_wc_conflict_reason_added },
   { "replaced",    svn_wc_conflict_reason_replaced },
   { "unversioned", svn_wc_conflict_reason_unversioned },
+  { "moved-here", svn_wc_conflict_reason_moved_here },
+  { "moved-away", svn_wc_conflict_reason_moved_away },
   { NULL }
 };
 

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1159362&r1=1159361&r2=1159362&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Thu Aug 18 19:14:48 2011
@@ -1272,7 +1272,8 @@ create_tree_conflict(svn_wc_conflict_des
   /* Get the source-left information, i.e. the local state of the node
    * before any changes were made to the working copy, i.e. the state the
    * node would have if it was reverted. */
-  if (reason == svn_wc_conflict_reason_added)
+  if (reason == svn_wc_conflict_reason_added ||
+      reason == svn_wc_conflict_reason_moved_here)
     {
       svn_wc__db_status_t added_status;
 
@@ -1327,6 +1328,7 @@ create_tree_conflict(svn_wc_conflict_des
        * and that other case should also be handled. */
       SVN_ERR_ASSERT(reason == svn_wc_conflict_reason_edited
                      || reason == svn_wc_conflict_reason_deleted
+                     || reason == svn_wc_conflict_reason_moved_away
                      || reason == svn_wc_conflict_reason_replaced
                      || reason == svn_wc_conflict_reason_obstructed);
 
@@ -1364,7 +1366,8 @@ create_tree_conflict(svn_wc_conflict_des
       /* This is an 'update', so REPOS_RELPATH would be the same as for
        * source-left. However, we don't have a source-left for locally
        * added files. */
-      right_repos_relpath = (reason == svn_wc_conflict_reason_added ?
+      right_repos_relpath = ((reason == svn_wc_conflict_reason_added ||
+                              reason == svn_wc_conflict_reason_moved_here) ?
                              added_repos_relpath : left_repos_relpath);
       if (! right_repos_relpath)
         right_repos_relpath = their_relpath;
@@ -1496,7 +1499,18 @@ check_tree_conflict(svn_wc_conflict_desc
              * would not have been called in the first place. */
             SVN_ERR_ASSERT(action == svn_wc_conflict_action_add);
 
-            reason = svn_wc_conflict_reason_added;
+            /* Scan the addition in case our caller didn't. */
+            if (working_status == svn_wc__db_status_added)
+              SVN_ERR(svn_wc__db_scan_addition(&working_status, NULL, NULL,
+                                               NULL, NULL, NULL, NULL,
+                                               NULL, NULL, NULL, NULL,
+                                               eb->db, local_abspath,
+                                               scratch_pool, scratch_pool));
+
+            if (working_status == svn_wc__db_status_moved_here)
+              reason = svn_wc_conflict_reason_moved_here;
+            else
+              reason = svn_wc_conflict_reason_added;
           }
         else
           {
@@ -1507,8 +1521,20 @@ check_tree_conflict(svn_wc_conflict_desc
 
 
       case svn_wc__db_status_deleted:
-        /* The node is locally deleted. */
-        reason = svn_wc_conflict_reason_deleted;
+        {
+          const char *moved_to_abspath;
+
+          /* The node is locally deleted. Check if it was moved away.
+           * ### should scan_deletion return status_moved_away, like
+           * ### scan_addition returns status_moved_here? */
+          SVN_ERR(svn_wc__db_scan_deletion(NULL, &moved_to_abspath, NULL,
+                                           NULL, eb->db, local_abspath,
+                                           scratch_pool, scratch_pool));
+          if (moved_to_abspath)
+            reason = svn_wc_conflict_reason_moved_away;
+          else
+            reason = svn_wc_conflict_reason_deleted;
+        }
         break;
 
       case svn_wc__db_status_incomplete:
@@ -1573,6 +1599,7 @@ check_tree_conflict(svn_wc_conflict_desc
    * would not have been called in the first place.*/
   if (reason == svn_wc_conflict_reason_edited
       || reason == svn_wc_conflict_reason_deleted
+      || reason == svn_wc_conflict_reason_moved_away
       || reason == svn_wc_conflict_reason_replaced)
     /* When the node existed before (it was locally deleted, replaced or
      * edited), then 'update' cannot add it "again". So it can only send
@@ -1580,7 +1607,8 @@ check_tree_conflict(svn_wc_conflict_desc
     SVN_ERR_ASSERT(action == svn_wc_conflict_action_edit
                    || action == svn_wc_conflict_action_delete
                    || action == svn_wc_conflict_action_replace);
-  else if (reason == svn_wc_conflict_reason_added)
+  else if (reason == svn_wc_conflict_reason_added ||
+           reason == svn_wc_conflict_reason_moved_here)
     /* When the node did not exist before (it was locally added), then 'update'
      * cannot want to modify it in any way. It can only send _action_add. */
     SVN_ERR_ASSERT(action == svn_wc_conflict_action_add);
@@ -1835,6 +1863,7 @@ delete_entry(const char *path,
              keeping a not-present marker */
         }
       else if (tree_conflict->reason == svn_wc_conflict_reason_deleted
+               || tree_conflict->reason == svn_wc_conflict_reason_moved_away
                || tree_conflict->reason == svn_wc_conflict_reason_replaced)
         {
           /* The item does not exist locally because it was already shadowed.
@@ -2355,6 +2384,7 @@ open_directory(const char *path,
       /* Other modifications wouldn't be a tree conflict */
       SVN_ERR_ASSERT(
                 tree_conflict->reason == svn_wc_conflict_reason_deleted ||
+                tree_conflict->reason == svn_wc_conflict_reason_moved_away ||
                 tree_conflict->reason == svn_wc_conflict_reason_replaced);
 
       /* Continue updating BASE */
@@ -3349,6 +3379,7 @@ open_file(const char *path,
       /* Other modifications wouldn't be a tree conflict */
       SVN_ERR_ASSERT(
                 tree_conflict->reason == svn_wc_conflict_reason_deleted ||
+                tree_conflict->reason == svn_wc_conflict_reason_moved_away||
                 tree_conflict->reason == svn_wc_conflict_reason_replaced);
 
       /* Continue updating BASE */

Modified: subversion/trunk/subversion/svn/tree-conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/tree-conflicts.c?rev=1159362&r1=1159361&r2=1159362&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/tree-conflicts.c (original)
+++ subversion/trunk/subversion/svn/tree-conflicts.c Thu Aug 18 19:14:48 2011
@@ -62,6 +62,8 @@ static const svn_token_map_t map_conflic
   { N_("add"),          svn_wc_conflict_reason_added },
   { N_("replace"),      svn_wc_conflict_reason_replaced },
   { N_("unversioned"),  svn_wc_conflict_reason_unversioned },
+  { N_("moved away"),   svn_wc_conflict_reason_moved_away },
+  { N_("moved here"),   svn_wc_conflict_reason_moved_here },
   { NULL,               0 }
 };
 
@@ -75,6 +77,8 @@ static const svn_token_map_t map_conflic
   { "add",              svn_wc_conflict_reason_added },
   { "replace",          svn_wc_conflict_reason_replaced },
   { "unversioned",      svn_wc_conflict_reason_unversioned },
+  { "moved-away",       svn_wc_conflict_reason_moved_away },
+  { "moved-here",       svn_wc_conflict_reason_moved_here },
   { NULL,               0 }
 };