You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ne...@apache.org on 2011/08/17 03:12:18 UTC

svn commit: r1158485 - /subversion/trunk/subversion/libsvn_wc/wc_db.c

Author: neels
Date: Wed Aug 17 01:12:17 2011
New Revision: 1158485

URL: http://svn.apache.org/viewvc?rev=1158485&view=rev
Log:
Fix a bug getting moved-to information for nested moves, i.e.:
  svn mv a/b bb        |      svn mv a aa
  svn delete a        O R     svn mv aa/b bb  
  svn status a/b       |      svn status a/b

Previously, scan_deletion("a/b") would first grab the proper "a/b moved to bb"
information, but would then carry on using the moved-to of node 'a' (again),
resulting in wrong returned values.

This patch causes 'svn status' to show correct moved-to info on nodes like
'a/b' above, that are the root of a move while "hidden" inside a
moved-away/deleted subtree.

* subversion/libsvn_wc/wc_db.c
  (scan_deletion_txn): Get moved-to info at most once. Also, if possible,
    break the loop with the first moved-to info found.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc_db.c

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1158485&r1=1158484&r2=1158485&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Wed Aug 17 01:12:17 2011
@@ -9669,6 +9669,7 @@ scan_deletion_txn(void *baton,
   svn_wc__db_status_t child_presence;
   svn_boolean_t child_has_base = FALSE;
   apr_int64_t local_op_depth, op_depth;
+  svn_boolean_t found_moved_to = FALSE;
 
   /* Initialize all the OUT parameters.  */
   if (sd_baton->base_del_relpath != NULL)
@@ -9795,9 +9796,12 @@ scan_deletion_txn(void *baton,
              gimmick, not a real node that may have been deleted.  */
         }
 
-      if ((sd_baton->moved_to_relpath != NULL
-                || sd_baton->moved_to_op_root_relpath != NULL
-                || sd_baton->base_del_relpath != NULL)
+      /* Evaluate moved-to information. Once moved-to info has been found, it
+       * must not be overwritten with ancestors' moved-to info. */
+      if ((! found_moved_to)
+          && (sd_baton->moved_to_relpath != NULL
+              || sd_baton->moved_to_op_root_relpath != NULL
+              || sd_baton->base_del_relpath != NULL)
           && !svn_sqlite__column_is_null(stmt, 2 /* moved_to */))
         {
           const char *moved_to_op_root_relpath;
@@ -9888,6 +9892,13 @@ scan_deletion_txn(void *baton,
             *sd_baton->moved_to_op_root_relpath = moved_to_op_root_relpath ?
               apr_pstrdup(sd_baton->result_pool, moved_to_op_root_relpath)
               : NULL;
+
+          /* If all other out parameters are irrelevant, stop scanning.
+           * Happens to be only WORK_DEL_RELPATH. */
+          if (sd_baton->work_del_relpath == NULL)
+            break;
+
+          found_moved_to = TRUE;
         }
 
       op_depth = svn_sqlite__column_int64(stmt, 3);