You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by sv...@apache.org on 2015/04/18 06:00:45 UTC

svn commit: r1674438 - in /subversion/branches/1.9.x: ./ STATUS subversion/libsvn_wc/externals.c subversion/libsvn_wc/wc-queries.sql subversion/libsvn_wc/wc_db.c subversion/tests/cmdline/externals_tests.py subversion/tests/libsvn_wc/op-depth-test.c

Author: svn-role
Date: Sat Apr 18 04:00:44 2015
New Revision: 1674438

URL: http://svn.apache.org/r1674438
Log:
Merge r1664035 from trunk:

 * r1664035
   Keep track of changes when a file external is replace by a real file
   Justification:
     When a file-external is deleted, there might be a real node that
     want to take its place. This patch makes svn update introduce a
     not present marker node, so a follow-up update will bring in the
     new file (that was previously reported as skipped)
   Notes:
     To implement this some features had to be added to the generic
     base remove function.
   Votes:
     +1: rhuijben, brane, philip

Modified:
    subversion/branches/1.9.x/   (props changed)
    subversion/branches/1.9.x/STATUS
    subversion/branches/1.9.x/subversion/libsvn_wc/externals.c
    subversion/branches/1.9.x/subversion/libsvn_wc/wc-queries.sql
    subversion/branches/1.9.x/subversion/libsvn_wc/wc_db.c
    subversion/branches/1.9.x/subversion/tests/cmdline/externals_tests.py
    subversion/branches/1.9.x/subversion/tests/libsvn_wc/op-depth-test.c

Propchange: subversion/branches/1.9.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Apr 18 04:00:44 2015
@@ -91,4 +91,4 @@
 /subversion/branches/verify-at-commit:1462039-1462408
 /subversion/branches/verify-keep-going:1439280-1546110
 /subversion/branches/wc-collate-path:1402685-1480384
-/subversion/trunk:1660545-1660547,1660549-1662901,1663003,1663183-1663184,1663338,1663347,1663355,1663374,1663450,1663671,1663697,1663706,1663738,1663749,1663791,1663991,1664078,1664080,1664084-1664085,1664187,1664191,1664193,1664200,1664344,1664476,1664480-1664481,1664483,1664489-1664490,1664507,1664520-1664521,1664523,1664526-1664527,1664531-1664532,1664588,1664593-1664594,1664596,1664653,1664664,1664672,1664674,1664684,1664927,1664938-1664940,1664978,1664984,1664997,1665164,1665195,1665213,1665259,1665318,1665437-1665438,1665609,1665611-1665612,1665845,1665850,1665852,1665886,1665894,1665896,1666096,1666258,1666270,1666272,1666379,1666449,1666690,1666832,1666851,1667101,1667106-1667107,1667228,1667233-1667235,1667249-1667250,1667258,1667290,1667301,1667471,1667691-1667693,1667715,1667941,1667976,1668320,1668598-1668600,1668602-1668603,1668607-1668608,1668618,1669743,1669746,1669749,1669945,1670139,1670149,1670152,1670329,1670337,1670347,1670353,1671164,1671388,1672295,1672311,167
 2372,1672404,1672511-1672512,1672578,1672728,1673044,1673062-1673063,1673065,1673153,1673170,1673172,1673197,1673202,1673204,1673228,1673282,1673445,1673691-1673692,1673746,1673785,1673803,1674015,1674032,1674170
+/subversion/trunk:1660545-1660547,1660549-1662901,1663003,1663183-1663184,1663338,1663347,1663355,1663374,1663450,1663671,1663697,1663706,1663738,1663749,1663791,1663991,1664035,1664078,1664080,1664084-1664085,1664187,1664191,1664193,1664200,1664344,1664476,1664480-1664481,1664483,1664489-1664490,1664507,1664520-1664521,1664523,1664526-1664527,1664531-1664532,1664588,1664593-1664594,1664596,1664653,1664664,1664672,1664674,1664684,1664927,1664938-1664940,1664978,1664984,1664997,1665164,1665195,1665213,1665259,1665318,1665437-1665438,1665609,1665611-1665612,1665845,1665850,1665852,1665886,1665894,1665896,1666096,1666258,1666270,1666272,1666379,1666449,1666690,1666832,1666851,1667101,1667106-1667107,1667228,1667233-1667235,1667249-1667250,1667258,1667290,1667301,1667471,1667691-1667693,1667715,1667941,1667976,1668320,1668598-1668600,1668602-1668603,1668607-1668608,1668618,1669743,1669746,1669749,1669945,1670139,1670149,1670152,1670329,1670337,1670347,1670353,1671164,1671388,1672295,167
 2311,1672372,1672404,1672511-1672512,1672578,1672728,1673044,1673062-1673063,1673065,1673153,1673170,1673172,1673197,1673202,1673204,1673228,1673282,1673445,1673691-1673692,1673746,1673785,1673803,1674015,1674032,1674170

Modified: subversion/branches/1.9.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/STATUS?rev=1674438&r1=1674437&r2=1674438&view=diff
==============================================================================
--- subversion/branches/1.9.x/STATUS (original)
+++ subversion/branches/1.9.x/STATUS Sat Apr 18 04:00:44 2015
@@ -38,19 +38,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * r1664035
-   Keep track of changes when a file external is replace by a real file
-   Justification:
-     When a file-external is deleted, there might be a real node that
-     want to take its place. This patch makes svn update introduce a
-     not present marker node, so a follow-up update will bring in the
-     new file (that was previously reported as skipped)
-   Notes:
-     To implement this some features had to be added to the generic
-     base remove function.
-   Votes:
-     +1: rhuijben, brane, philip
-
  * r1666965, r1667120
    mod_dav_svn: Emit the first few 'svn log' items as soon as they are available.
    Justification:

Modified: subversion/branches/1.9.x/subversion/libsvn_wc/externals.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/libsvn_wc/externals.c?rev=1674438&r1=1674437&r2=1674438&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/libsvn_wc/externals.c (original)
+++ subversion/branches/1.9.x/subversion/libsvn_wc/externals.c Sat Apr 18 04:00:44 2015
@@ -1496,8 +1496,8 @@ svn_wc__external_remove(svn_wc_context_t
   else
     {
       SVN_ERR(svn_wc__db_base_remove(wc_ctx->db, local_abspath,
-                                     FALSE, FALSE, FALSE,
-                                     SVN_INVALID_REVNUM,
+                                     FALSE, TRUE, FALSE,
+                                     0,
                                      NULL, NULL, scratch_pool));
       SVN_ERR(svn_wc__wq_run(wc_ctx->db, local_abspath,
                              cancel_func, cancel_baton,

Modified: subversion/branches/1.9.x/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/libsvn_wc/wc-queries.sql?rev=1674438&r1=1674437&r2=1674438&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/branches/1.9.x/subversion/libsvn_wc/wc-queries.sql Sat Apr 18 04:00:44 2015
@@ -249,7 +249,8 @@ WHERE wc_id = ?1 AND IS_STRICT_DESCENDAN
 
 -- STMT_DELETE_BASE_RECURSIVE
 DELETE FROM nodes
-WHERE wc_id = ?1 AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
+WHERE wc_id = ?1 AND (local_relpath = ?2 
+                      OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND op_depth = 0
 
 -- STMT_DELETE_WORKING_OP_DEPTH

Modified: subversion/branches/1.9.x/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/libsvn_wc/wc_db.c?rev=1674438&r1=1674437&r2=1674438&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/1.9.x/subversion/libsvn_wc/wc_db.c Sat Apr 18 04:00:44 2015
@@ -2125,11 +2125,13 @@ db_base_remove(svn_wc__db_wcroot_t *wcro
   int op_depth;
   svn_node_kind_t wrk_kind;
   svn_boolean_t no_delete_wc = FALSE;
+  svn_boolean_t file_external;
 
   SVN_ERR(svn_wc__db_base_get_info_internal(&status, &kind, &revision,
                                             &repos_relpath, &repos_id,
                                             NULL, NULL, NULL, NULL, NULL,
-                                            NULL, NULL, NULL, NULL, NULL,
+                                            NULL, NULL, NULL, NULL,
+                                            &file_external,
                                             wcroot, local_relpath,
                                             scratch_pool, scratch_pool));
 
@@ -2360,35 +2362,69 @@ db_base_remove(svn_wc__db_wcroot_t *wcro
   SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
   SVN_ERR(svn_sqlite__step_done(stmt));
 
-  /* Step 5: handle the BASE node itself */
-  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
-                                    STMT_DELETE_BASE_NODE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
-  SVN_ERR(svn_sqlite__step_done(stmt));
-
   SVN_ERR(db_retract_parent_delete(wcroot, local_relpath, 0, scratch_pool));
 
   if (mark_not_present || mark_excluded)
     {
       struct insert_base_baton_t ibb;
-      blank_ibb(&ibb);
+      svn_boolean_t no_marker = FALSE;
 
-      ibb.repos_id = repos_id;
-      ibb.status = mark_excluded ? svn_wc__db_status_excluded
-                                 : svn_wc__db_status_not_present;
-      ibb.kind = kind;
-      ibb.repos_relpath = repos_relpath;
-      ibb.revision = SVN_IS_VALID_REVNUM(marker_revision)
-                        ? marker_revision
-                        : revision;
-
-      /* Depending upon KIND, any of these might get used. */
-      ibb.children = NULL;
-      ibb.depth = svn_depth_unknown;
-      ibb.checksum = NULL;
-      ibb.target = NULL;
+      if (file_external)
+        {
+          const char *parent_local_relpath;
+          const char *name;
+          svn_error_t *err;
 
-      SVN_ERR(insert_base_node(&ibb, wcroot, local_relpath, scratch_pool));
+          /* For file externals we only want to place a not present marker
+             if there is a BASE parent */
+          
+          svn_relpath_split(&parent_local_relpath, &name, local_relpath,
+                            scratch_pool);
+
+          err = svn_wc__db_base_get_info_internal(NULL, NULL, NULL,
+                                                  &repos_relpath, &repos_id,
+                                                  NULL, NULL, NULL, NULL, NULL,
+                                                  NULL, NULL, NULL, NULL, NULL,
+                                                  wcroot, parent_local_relpath,
+                                                  scratch_pool, scratch_pool);
+
+          if (err && err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
+            return svn_error_trace(err);
+          else if (err)
+            {
+              svn_error_clear(err);
+              no_marker = TRUE;
+            }
+          else
+            {
+              /* Replace the repos_relpath with something more expected than
+                 the unrelated old file external repository relpath, which
+                 one day may come from a different repository */
+              repos_relpath = svn_relpath_join(repos_relpath, name, scratch_pool);
+            }
+        }
+
+      if (!no_marker)
+        {
+          blank_ibb(&ibb);
+
+          ibb.repos_id = repos_id;
+          ibb.status = mark_excluded ? svn_wc__db_status_excluded
+                                     : svn_wc__db_status_not_present;
+          ibb.kind = kind;
+          ibb.repos_relpath = repos_relpath;
+          ibb.revision = SVN_IS_VALID_REVNUM(marker_revision)
+                            ? marker_revision
+                            : revision;
+
+          /* Depending upon KIND, any of these might get used. */
+          ibb.children = NULL;
+          ibb.depth = svn_depth_unknown;
+          ibb.checksum = NULL;
+          ibb.target = NULL;
+
+          SVN_ERR(insert_base_node(&ibb, wcroot, local_relpath, scratch_pool));
+        }
     }
 
   SVN_ERR(add_work_items(wcroot->sdb, work_items, scratch_pool));
@@ -3480,11 +3516,18 @@ db_external_remove(const svn_skel_t *wor
                    apr_pool_t *scratch_pool)
 {
   svn_sqlite__stmt_t *stmt;
+  int affected_rows;
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_DELETE_EXTERNAL));
   SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
-  SVN_ERR(svn_sqlite__step_done(stmt));
+  SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
+
+  if (!affected_rows)
+    return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
+                             _("The node '%s' is not an external."),
+                             path_for_error_message(wcroot, local_relpath,
+                                                    scratch_pool));
 
   SVN_ERR(add_work_items(wcroot->sdb, work_items, scratch_pool));
 

Modified: subversion/branches/1.9.x/subversion/tests/cmdline/externals_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/tests/cmdline/externals_tests.py?rev=1674438&r1=1674437&r2=1674438&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/tests/cmdline/externals_tests.py (original)
+++ subversion/branches/1.9.x/subversion/tests/cmdline/externals_tests.py Sat Apr 18 04:00:44 2015
@@ -4086,6 +4086,75 @@ def nested_notification(sbox):
   svntest.actions.run_and_verify_svn(expected_output, [],
                                      'update', sbox.ospath('D1'))
 
+def file_external_to_normal_file(sbox):
+  "change a file external to a normal file"
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+  sbox.simple_propset('svn:externals', '^/iota iota', 'A')
+  sbox.simple_commit()
+
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
+  expected_status.add({
+    'A/iota'            : Item(status='  ', wc_rev='2', switched='X'),
+  })
+  expected_output = svntest.wc.State(wc_dir, {
+    'A/iota'            : Item(status='A '),
+  })
+
+  svntest.actions.run_and_verify_update(wc_dir, expected_output, None,
+                                        expected_status)
+
+  # Create second working copy in this state
+  sbox2 = sbox.clone_dependent(copy_wc=True)
+
+  sbox.simple_propdel('svn:externals', 'A')
+
+  expected_output = svntest.wc.State(wc_dir, {
+      'A/iota'            : Item(verb='Removed external'),
+  })
+  expected_status.remove('A/iota')
+  expected_status.tweak('A', status=' M')
+  svntest.actions.run_and_verify_update(wc_dir, expected_output, None,
+                                        expected_status)
+
+  sbox.simple_copy('iota', 'A/iota')
+  sbox.simple_commit()
+
+  expected_output = svntest.wc.State(wc_dir, {
+  })
+  expected_status.tweak(wc_rev=3)
+  expected_status.tweak('A', status='  ')
+  expected_status.add({
+    # This case used to triggered a switched status in 1.8.x before this
+    # test (and the fix for this problem) where added.
+    'A/iota'            : Item(status='  ', wc_rev='3'),
+  })
+  svntest.actions.run_and_verify_update(wc_dir, expected_output, None,
+                                        expected_status)
+
+
+  wc_dir = sbox2.wc_dir
+
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 3)
+  expected_output = svntest.wc.State(wc_dir, {
+    'A'                 : Item(status=' U'),
+    'A/iota'            : Item(verb='Removed external', prev_verb='Skipped'),
+  })
+  # This reports an obstruction and removes the file external
+  svntest.actions.run_and_verify_update(wc_dir, expected_output, None,
+                                        expected_status)
+
+  expected_status.add({
+    'A/iota'            : Item(status='  ', wc_rev='3'),
+  })
+  expected_output = svntest.wc.State(wc_dir, {
+    'A/iota'            : Item(status='A '),
+  })
+  # This should bring in the new file
+  svntest.actions.run_and_verify_update(wc_dir, expected_output, None,
+                                        expected_status)
+
 
 ########################################################################
 # Run the tests
@@ -4159,6 +4228,7 @@ test_list = [ None,
               copy_pin_externals_wc_mixed_revisions,
               copy_pin_externals_whitepace_dir,
               nested_notification,
+              file_external_to_normal_file,
              ]
 
 if __name__ == '__main__':

Modified: subversion/branches/1.9.x/subversion/tests/libsvn_wc/op-depth-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/tests/libsvn_wc/op-depth-test.c?rev=1674438&r1=1674437&r2=1674438&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/branches/1.9.x/subversion/tests/libsvn_wc/op-depth-test.c Sat Apr 18 04:00:44 2015
@@ -310,16 +310,17 @@ check_db_rows(svn_test__sandbox_t *b,
       row->repo_revnum = svn_sqlite__column_revnum(stmt, 3);
       row->repo_relpath = svn_sqlite__column_text(stmt, 4, b->pool);
       row->file_external = !svn_sqlite__column_is_null(stmt, 5);
-      if (row->file_external && svn_sqlite__column_is_null(stmt, 6))
-        comparison_baton.errors
-          = svn_error_createf(SVN_ERR_TEST_FAILED, comparison_baton.errors,
-                              "incomplete {%s}", print_row(row, b->pool));
       row->moved_to = svn_sqlite__column_text(stmt, 7, b->pool);
       row->moved_here = svn_sqlite__column_boolean(stmt, 8);
       SVN_ERR(svn_sqlite__column_properties(&props_hash, stmt, 9,
                                             b->pool, b->pool));
       row->props = props_hash_to_text(props_hash, b->pool);
 
+      if (row->file_external && svn_sqlite__column_is_null(stmt, 6))
+        comparison_baton.errors
+          = svn_error_createf(SVN_ERR_TEST_FAILED, comparison_baton.errors,
+                              "incomplete {%s}", print_row(row, b->pool));
+
       key = apr_psprintf(b->pool, "%d %s", row->op_depth, row->local_relpath);
       apr_hash_set(found_hash, key, APR_HASH_KEY_STRING, row);
 
@@ -3582,11 +3583,13 @@ revert_file_externals(const svn_test_opt
   SVN_ERR(sbox_wc_update(&b, "", 1));
   {
     nodes_row_t rows[] = {
-      { 0, "",    "normal", 1, "" },
-      { 0, "f",   "normal", 1, "f" },
-      { 1, "A",   "normal", NO_COPY_FROM },
-      { 0, "h",   "normal", 1, "f", TRUE },
-      { 0, "A/g", "normal", 1, "f", TRUE },
+      { 0, "",    "normal",      1, "" },
+      { 0, "f",   "normal",      1, "f" },
+      { 1, "A",   "normal",      NO_COPY_FROM },
+      { 0, "h",   "normal",      1, "f", TRUE },
+      { 0, "A/g", "normal",      1, "f", TRUE },
+
+      { 0, "g",   "not-present", 0, "g"},
       { 0 }
     };
     SVN_ERR(check_db_rows(&b, "", rows));
@@ -3595,10 +3598,12 @@ revert_file_externals(const svn_test_opt
   SVN_ERR(sbox_wc_revert(&b, "", svn_depth_infinity));
   {
     nodes_row_t rows[] = {
-      { 0, "",    "normal", 1, "" },
-      { 0, "f",   "normal", 1, "f" },
-      { 0, "h",   "normal", 1, "f", TRUE },
-      { 0, "A/g", "normal", 1, "f", TRUE },
+      { 0, "",    "normal",      1, "" },
+      { 0, "f",   "normal",      1, "f" },
+      { 0, "h",   "normal",      1, "f", TRUE },
+      { 0, "A/g", "normal",      1, "f", TRUE },
+
+      { 0, "g",   "not-present", 0, "g"},
       { 0 }
     };
     SVN_ERR(check_db_rows(&b, "", rows));
@@ -3607,9 +3612,11 @@ revert_file_externals(const svn_test_opt
   SVN_ERR(sbox_wc_update(&b, "", 1));
   {
     nodes_row_t rows[] = {
-      { 0, "",    "normal", 1, "" },
-      { 0, "f",   "normal", 1, "f" },
-      { 0, "g",   "normal", 1, "f", TRUE },
+      { 0, "",    "normal",      1, "" },
+      { 0, "f",   "normal",      1, "f" },
+      { 0, "g",   "normal",      1, "f", TRUE },
+
+      { 0, "h",   "not-present", 0, "h"},
       { 0 }
     };
     SVN_ERR(check_db_rows(&b, "", rows));