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 2013/04/30 06:01:16 UTC

svn commit: r1477465 - in /subversion/branches/1.8.x: ./ subversion/libsvn_wc/ subversion/tests/cmdline/ subversion/tests/cmdline/upgrade_tests_data/

Author: svn-role
Date: Tue Apr 30 04:01:16 2013
New Revision: 1477465

URL: http://svn.apache.org/r1477465
Log:
Merge the r1470904 group from trunk:

 * r1470904, r1471744, r1475963, r1476155, r1476181, r1476254
   Tweak an upgrade Sql statement to be easier to understand and a tiny bit
   faster
   Justification:
     The old variant had some theoretical upgrade problems.
   Notes:
     r1470904, r1471744, r1475963 are a series of tweaks to the
     STMT_UPGRADE_31_SELECT_WCROOT_NODES query.  r1476155 is a new
     upgrade test.  r1476181, r1476254 are for 1.6 upgrades.
   Votes:
     +1: philip, pburba, rhuijben

Added:
    subversion/branches/1.8.x/subversion/tests/cmdline/upgrade_tests_data/iprops_upgrade_nonroot.tar.bz2
      - copied unchanged from r1476155, subversion/trunk/subversion/tests/cmdline/upgrade_tests_data/iprops_upgrade_nonroot.tar.bz2
    subversion/branches/1.8.x/subversion/tests/cmdline/upgrade_tests_data/iprops_upgrade_nonroot1_6.tar.bz2
      - copied unchanged from r1476181, subversion/trunk/subversion/tests/cmdline/upgrade_tests_data/iprops_upgrade_nonroot1_6.tar.bz2
    subversion/branches/1.8.x/subversion/tests/cmdline/upgrade_tests_data/iprops_upgrade_root.tar.bz2
      - copied unchanged from r1476155, subversion/trunk/subversion/tests/cmdline/upgrade_tests_data/iprops_upgrade_root.tar.bz2
    subversion/branches/1.8.x/subversion/tests/cmdline/upgrade_tests_data/iprops_upgrade_root1_6.tar.bz2
      - copied unchanged from r1476181, subversion/trunk/subversion/tests/cmdline/upgrade_tests_data/iprops_upgrade_root1_6.tar.bz2
Modified:
    subversion/branches/1.8.x/   (props changed)
    subversion/branches/1.8.x/STATUS
    subversion/branches/1.8.x/subversion/libsvn_wc/entries.c
    subversion/branches/1.8.x/subversion/libsvn_wc/wc-metadata.sql
    subversion/branches/1.8.x/subversion/tests/cmdline/upgrade_tests.py

Propchange: subversion/branches/1.8.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1470904,1471744,1475963,1476155,1476181,1476254

Modified: subversion/branches/1.8.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1477465&r1=1477464&r2=1477465&view=diff
==============================================================================
--- subversion/branches/1.8.x/STATUS (original)
+++ subversion/branches/1.8.x/STATUS Tue Apr 30 04:01:16 2013
@@ -101,18 +101,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * r1470904, r1471744, r1475963, r1476155, r1476181, r1476254
-   Tweak an upgrade Sql statement to be easier to understand and a tiny bit
-   faster
-   Justification:
-     The old variant had some theoretical upgrade problems.
-   Notes:
-     r1470904, r1471744, r1475963 are a series of tweaks to the
-     STMT_UPGRADE_31_SELECT_WCROOT_NODES query.  r1476155 is a new
-     upgrade test.  r1476181, r1476254 are for 1.6 upgrades.
-   Votes:
-     +1: philip, pburba, rhuijben
-
  * r1470031
    Correctly set the 'action' and 'reason' fields of a property conflict.
    API users were seeing the wrong 'action' and 'reason' for some property

Modified: subversion/branches/1.8.x/subversion/libsvn_wc/entries.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_wc/entries.c?rev=1477465&r1=1477464&r2=1477465&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_wc/entries.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_wc/entries.c Tue Apr 30 04:01:16 2013
@@ -73,6 +73,7 @@ typedef struct db_node_t {
   apr_time_t recorded_time;
   apr_hash_t *properties;
   svn_boolean_t file_external;
+  apr_array_header_t *inherited_props;
 } db_node_t;
 
 typedef struct db_actual_node_t {
@@ -1521,6 +1522,10 @@ insert_node(svn_sqlite__db_t *sdb,
   if (node->file_external)
     SVN_ERR(svn_sqlite__bind_int(stmt, 20, 1));
 
+  if (node->inherited_props)
+    SVN_ERR(svn_sqlite__bind_iprops(stmt, 23, node->inherited_props,
+                                    scratch_pool));
+
   SVN_ERR(svn_sqlite__insert(NULL, stmt));
 
   return SVN_NO_ERROR;
@@ -1574,6 +1579,31 @@ insert_actual_node(svn_sqlite__db_t *sdb
   return svn_error_trace(svn_sqlite__insert(NULL, stmt));
 }
 
+static svn_boolean_t
+is_switched(db_node_t *parent,
+            db_node_t *child,
+            apr_pool_t *scratch_pool)
+{
+  if (parent && child)
+    {
+      if (parent->repos_id != child->repos_id)
+        return TRUE;
+
+      if (parent->repos_relpath && child->repos_relpath)
+        {
+          const char *unswitched
+            = svn_relpath_join(parent->repos_relpath,
+                               svn_relpath_basename(child->local_relpath,
+                                                    scratch_pool),
+                               scratch_pool);
+          if (strcmp(unswitched, child->repos_relpath))
+            return TRUE;
+        }
+    }
+
+  return FALSE;
+}
+
 struct write_baton {
   db_node_t *base;
   db_node_t *work;
@@ -2071,6 +2101,12 @@ write_entry(struct write_baton **entry_n
       if (entry->file_external_path)
         base_node->file_external = TRUE;
 
+      /* Switched nodes get an empty iprops cache. */
+      if (parent_node
+          && is_switched(parent_node->base, base_node, scratch_pool))
+        base_node->inherited_props
+          = apr_array_make(scratch_pool, 0, sizeof(svn_prop_inherited_item_t*));
+
       SVN_ERR(insert_node(sdb, base_node, scratch_pool));
 
       /* We have to insert the lock after the base node, because the node

Modified: subversion/branches/1.8.x/subversion/libsvn_wc/wc-metadata.sql
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_wc/wc-metadata.sql?rev=1477465&r1=1477464&r2=1477465&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_wc/wc-metadata.sql (original)
+++ subversion/branches/1.8.x/subversion/libsvn_wc/wc-metadata.sql Tue Apr 30 04:01:16 2013
@@ -840,17 +840,13 @@ PRAGMA user_version = 31;
 SELECT l.wc_id, l.local_relpath FROM nodes as l
 LEFT OUTER JOIN nodes as r
 ON l.wc_id = r.wc_id
-   AND l.repos_id = r.repos_id
    AND r.local_relpath = l.parent_relpath
-WHERE (l.local_relpath = '' AND l.repos_path != '')
-   OR (l.op_depth = 0
-       AND l.local_relpath != ''
-       AND l.repos_path != ltrim(r.repos_path
-                                 || '/'
-                                 || ltrim(substr(l.local_relpath,
-                                                 length(l.parent_relpath) + 1),
-                                          '/'),
-                                 '/'))
+   AND r.op_depth = 0
+WHERE l.op_depth = 0
+  AND l.repos_path != ''
+  AND ((l.repos_id IS NOT r.repos_id)
+       OR (l.repos_path IS NOT RELPATH_SKIP_JOIN(r.local_relpath, r.repos_path, l.local_relpath)))
+
 
 /* ------------------------------------------------------------------------- */
 /* Format 32 ....  */

Modified: subversion/branches/1.8.x/subversion/tests/cmdline/upgrade_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/tests/cmdline/upgrade_tests.py?rev=1477465&r1=1477464&r2=1477465&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/tests/cmdline/upgrade_tests.py (original)
+++ subversion/branches/1.8.x/subversion/tests/cmdline/upgrade_tests.py Tue Apr 30 04:01:16 2013
@@ -1278,6 +1278,136 @@ def upgrade_from_1_7_conflict(sbox):
   # a working copy used to cause a pointless 'upgrade required' error.
   svntest.actions.run_and_verify_svn(None, None, [], 'upgrade', sbox.wc_dir)
 
+def do_iprops_upgrade(nonrootfile, rootfile, sbox):
+
+  wc_dir = sbox.wc_dir
+
+  replace_sbox_with_tarfile(sbox, nonrootfile)
+  svntest.actions.run_and_verify_svn(None, None, [], 'upgrade', sbox.wc_dir)
+  svntest.actions.run_and_verify_svn(None, None, [], 'relocate',
+                                     'file:///tmp/repo', sbox.repo_url, wc_dir)
+
+  expected_output = []
+  expected_disk = svntest.wc.State('', {
+      'E'       : Item(),
+      'E/alpha' : Item(contents="This is the file 'alpha'.\n"),
+      'E/beta'  : Item(contents="This is the file 'beta'.\n"),
+      'F'       : Item(),
+      'lambda'  : Item(contents="This is the file 'lambda'.\n"),
+      })
+  expected_status = svntest.wc.State(sbox.wc_dir, {
+      ''        : Item(),
+      'E'       : Item(switched='S'),
+      'E/alpha' : Item(),
+      'E/beta'  : Item(),
+      'F'       : Item(),
+      'lambda'  : Item(),
+      })
+  expected_status.tweak(status='  ', wc_rev=2)
+
+  # No inherited props after upgrade until an update
+  expected_iprops = {}
+  expected_explicit_props = {}
+  svntest.actions.run_and_verify_inherited_prop_xml(
+    wc_dir, expected_iprops, expected_explicit_props)
+  svntest.actions.run_and_verify_inherited_prop_xml(
+    sbox.ospath('E'), expected_iprops, expected_explicit_props)
+
+  # Update populates the inherited props
+  svntest.actions.run_and_verify_update(wc_dir,
+                                        expected_output,
+                                        expected_disk,
+                                        expected_status)
+
+  expected_iprops = {sbox.repo_url        : {'p'  : 'v'},
+                     sbox.repo_url + '/A' : {'pA' : 'vA'}}
+  svntest.actions.run_and_verify_inherited_prop_xml(
+    wc_dir, expected_iprops, expected_explicit_props)
+
+  expected_iprops = {sbox.repo_url        : {'p'  : 'v'},
+                     sbox.repo_url + '/X' : {'pX' : 'vX'}}
+  svntest.actions.run_and_verify_inherited_prop_xml(
+    sbox.ospath('E'), expected_iprops, expected_explicit_props)
+
+  # Now try with a repository root working copy
+  replace_sbox_with_tarfile(sbox, rootfile)
+  svntest.actions.run_and_verify_svn(None, None, [], 'upgrade', sbox.wc_dir)
+  svntest.actions.run_and_verify_svn(None, None, [], 'relocate',
+                                     'file:///tmp/repo', sbox.repo_url, wc_dir)
+
+  # Unswitched inherited props available after upgrade
+  expected_iprops = {wc_dir           : {'p'  : 'v'},
+                     sbox.ospath('A') : {'pA' : 'vA'}}
+  svntest.actions.run_and_verify_inherited_prop_xml(
+    sbox.ospath('A/B'), expected_iprops, expected_explicit_props)
+
+  # Switched inherited props not populated until update after upgrade
+  expected_iprops = {}
+  svntest.actions.run_and_verify_inherited_prop_xml(
+    sbox.ospath('A/B/E'), expected_iprops, expected_explicit_props)
+
+  expected_disk = svntest.wc.State('', {
+      'A'     : Item(),
+      'A/B'   : Item(),
+      'A/B/E' : Item(),
+      })
+  expected_status = svntest.wc.State(sbox.wc_dir, {
+      ''      : Item(),
+      'A'     : Item(),
+      'A/B'   : Item(),
+      'A/B/E' : Item(switched='S'),
+      })
+  expected_status.tweak(status='  ', wc_rev=2)
+  svntest.actions.run_and_verify_update(wc_dir,
+                                        expected_output,
+                                        expected_disk,
+                                        expected_status)
+
+  expected_iprops = {wc_dir           : {'p'  : 'v'},
+                     sbox.ospath('A') : {'pA' : 'vA'}}
+  svntest.actions.run_and_verify_inherited_prop_xml(
+    sbox.ospath('A/B'), expected_iprops, expected_explicit_props)
+
+  expected_iprops = {sbox.repo_url        : {'p'  : 'v'},
+                     sbox.repo_url + '/X' : {'pX' : 'vX'}}
+  expected_explicit_props = {}
+  svntest.actions.run_and_verify_inherited_prop_xml(
+    sbox.ospath('A/B/E'), expected_iprops, expected_explicit_props)
+
+def iprops_upgrade(sbox):
+  "inherited properties after upgrade from 1.7"
+
+  sbox.build()
+
+  sbox.simple_copy('A', 'X')
+  sbox.simple_propset('p', 'v', '')
+  sbox.simple_propset('pA', 'vA', 'A')
+  sbox.simple_propset('pX', 'vX', 'X')
+  sbox.simple_commit()
+  svntest.main.run_svnadmin('setuuid', sbox.repo_dir,
+                            '8f4d0ebe-2ebf-4f62-ad11-804fd88c2382')
+
+  do_iprops_upgrade('iprops_upgrade_nonroot.tar.bz2',
+                    'iprops_upgrade_root.tar.bz2',
+                    sbox)
+
+def iprops_upgrade1_6(sbox):
+  "inherited properties after upgrade from 1.6"
+
+  sbox.build()
+
+  sbox.simple_copy('A', 'X')
+  sbox.simple_propset('p', 'v', '')
+  sbox.simple_propset('pA', 'vA', 'A')
+  sbox.simple_propset('pX', 'vX', 'X')
+  sbox.simple_commit()
+  svntest.main.run_svnadmin('setuuid', sbox.repo_dir,
+                            '8f4d0ebe-2ebf-4f62-ad11-804fd88c2382')
+
+  do_iprops_upgrade('iprops_upgrade_nonroot1_6.tar.bz2',
+                    'iprops_upgrade_root1_6.tar.bz2',
+                    sbox)
+
 ########################################################################
 # Run the tests
 
@@ -1330,6 +1460,8 @@ test_list = [ None,
               upgrade_missing_replaced,
               upgrade_not_present_replaced,
               upgrade_from_1_7_conflict,
+              iprops_upgrade,
+              iprops_upgrade1_6,
              ]