You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2012/11/23 02:12:45 UTC

svn commit: r1412731 [8/10] - in /subversion/branches/ev2-export: ./ build/ build/ac-macros/ contrib/client-side/svnmerge/ contrib/server-side/svncutter/ notes/ subversion/ subversion/bindings/javahl/native/ subversion/bindings/swig/perl/native/ subver...

Modified: subversion/branches/ev2-export/subversion/tests/cmdline/svntest/sandbox.py
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/cmdline/svntest/sandbox.py?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/tests/cmdline/svntest/sandbox.py (original)
+++ subversion/branches/ev2-export/subversion/tests/cmdline/svntest/sandbox.py Fri Nov 23 01:12:18 2012
@@ -307,6 +307,17 @@ class Sandbox:
         raise Exception("Unexpected line '" + line + "' in proplist output" + str(out))
     return props
 
+  def simple_add_symlink(self, dest, target):
+    """Create a symlink TARGET pointing to DEST and add it to subversion"""
+    if svntest.main.is_posix_os():
+      os.symlink(dest, self.ospath(target))
+    else:
+      svntest.main.file_write(self.ospath(target), "link %s" % dest)
+    self.simple_add(target)
+    if not svntest.main.is_posix_os():
+      # '*' is evaluated on Windows
+      self.simple_propset('svn:special', 'X', target)
+
   def simple_copy(self, source, dest):
     """Copy SOURCE to DEST in the WC.
        SOURCE and DEST are relpaths relative to the WC."""

Modified: subversion/branches/ev2-export/subversion/tests/cmdline/svntest/verify.py
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/cmdline/svntest/verify.py?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/tests/cmdline/svntest/verify.py (original)
+++ subversion/branches/ev2-export/subversion/tests/cmdline/svntest/verify.py Fri Nov 23 01:12:18 2012
@@ -362,7 +362,7 @@ def compare_and_display_lines(message, l
 
   if isinstance(actual, str):
     actual = [actual]
-  actual = [line for line in actual if not line.startswith('DBG:')]
+  actual = svntest.main.filter_dbg(actual)
 
   if not expected.matches(actual, except_re):
     expected.display_differences(message, label, actual)

Modified: subversion/branches/ev2-export/subversion/tests/cmdline/svntest/wc.py
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/cmdline/svntest/wc.py?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/tests/cmdline/svntest/wc.py (original)
+++ subversion/branches/ev2-export/subversion/tests/cmdline/svntest/wc.py Fri Nov 23 01:12:18 2012
@@ -886,6 +886,14 @@ def text_base_path(file_path):
 
   raise svntest.Failure("No pristine text for " + relpath)
 
+def sqlite_stmt(wc_root_path, stmt):
+  """Execute STMT on the SQLite wc.db in WC_ROOT_PATH and return the
+     results."""
+
+  db = open_wc_db(wc_root_path)[0]
+  c = db.cursor()
+  c.execute(stmt)
+  return c.fetchall()
 
 # ------------
 ### probably toss these at some point. or major rework. or something.

Modified: subversion/branches/ev2-export/subversion/tests/cmdline/switch_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/cmdline/switch_tests.py?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/tests/cmdline/switch_tests.py (original)
+++ subversion/branches/ev2-export/subversion/tests/cmdline/switch_tests.py Fri Nov 23 01:12:18 2012
@@ -586,6 +586,11 @@ def file_dir_file(sbox):
   if not os.path.isdir(file_path):
     raise svntest.Failure
 
+  # The reason the following switch currently fails is that the node
+  # is determined to be a 'root', because it is switched against its parent.
+  # In this specific case the switch editor is designed to be rooted on the node
+  # itself instead of its ancestor. If you would use sbox.ospath('A') for
+  # file_path the switch works both ways.
   svntest.actions.run_and_verify_svn(None, None, [], 'switch',
                                      '--ignore-ancestry', file_url, file_path)
   if not os.path.isfile(file_path):
@@ -2219,8 +2224,9 @@ def switch_to_root(sbox):
 
 #----------------------------------------------------------------------
 # Make sure that switch continue after deleting locally modified
-# directories, as it update and merge do.
+# directories, as update and merge do.
 
+@Issue(2505)
 def tolerate_local_mods(sbox):
   "tolerate deletion of a directory with local mods"
 

Modified: subversion/branches/ev2-export/subversion/tests/cmdline/update_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/cmdline/update_tests.py?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/tests/cmdline/update_tests.py (original)
+++ subversion/branches/ev2-export/subversion/tests/cmdline/update_tests.py Fri Nov 23 01:12:18 2012
@@ -5735,6 +5735,7 @@ def update_moved_dir_file_move(sbox):
                                         None, None, 1)
 
 @XFail()
+@Issue(3144,3630)
 def update_move_text_mod(sbox):
   "text mod to moved files"
 
@@ -5784,6 +5785,7 @@ def update_move_text_mod(sbox):
                                         None, None, 1)
 
 @XFail()
+@Issue(3144,3630)
 def update_nested_move_text_mod(sbox):
   "text mod to moved file in moved dir"
 

Modified: subversion/branches/ev2-export/subversion/tests/cmdline/upgrade_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/cmdline/upgrade_tests.py?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/tests/cmdline/upgrade_tests.py (original)
+++ subversion/branches/ev2-export/subversion/tests/cmdline/upgrade_tests.py Fri Nov 23 01:12:18 2012
@@ -50,7 +50,7 @@ Issues = svntest.testcase.Issues_deco
 Issue = svntest.testcase.Issue_deco
 Wimp = svntest.testcase.Wimp_deco
 
-wc_is_too_old_regex = (".*Working copy '.*' is too old \(format \d+.*\).*")
+wc_is_too_old_regex = (".*is too old \(format \d+.*\).*")
 
 
 def get_current_format():
@@ -258,28 +258,29 @@ def basic_upgrade(sbox):
   replace_sbox_with_tarfile(sbox, 'basic_upgrade.tar.bz2')
 
   # Attempt to use the working copy, this should give an error
-  expected_stderr = wc_is_too_old_regex
-  svntest.actions.run_and_verify_svn(None, None, expected_stderr,
+  svntest.actions.run_and_verify_svn(None, None, wc_is_too_old_regex,
                                      'info', sbox.wc_dir)
 
-
-  # Upgrade on something not a versioned dir gives a 'not directory' error.
-  not_dir = ".*E155019.*%s'.*directory"
+  # Upgrade on something anywhere within a versioned subdir gives a
+  # 'not a working copy root' error. Upgrade on something without any
+  # versioned parent gives a 'not a working copy' error.
+  # Both cases use the same error code.
+  not_wc = ".*(E155007|E155019).*%s'.*not a working copy.*"
   os.mkdir(sbox.ospath('X'))
-  svntest.actions.run_and_verify_svn(None, None, not_dir % 'X',
+  svntest.actions.run_and_verify_svn(None, None, not_wc % 'X',
                                      'upgrade', sbox.ospath('X'))
 
-  svntest.actions.run_and_verify_svn(None, None, not_dir % 'Y',
+  # Upgrade on a non-existent subdir within an old WC gives a
+  # 'not a working copy' error.
+  svntest.actions.run_and_verify_svn(None, None, not_wc % 'Y',
                                      'upgrade', sbox.ospath('Y'))
-
-  svntest.actions.run_and_verify_svn(None, None, not_dir %
-                                        re.escape(sbox.ospath('A/mu')),
+  # Upgrade on a versioned file within an old WC gives a
+  # 'not a working copy' error.
+  svntest.actions.run_and_verify_svn(None, None, not_wc % 'mu',
                                      'upgrade', sbox.ospath('A/mu'))
-
-  # Upgrade on a versioned subdir gives a 'not root' error.
-  not_root = ".*E155019.*%s'.*root.*%s'"
-  svntest.actions.run_and_verify_svn(None, None, not_root %
-                                        ('A', re.escape(sbox.wc_dir)),
+  # Upgrade on a versioned dir within an old WC gives a
+  # 'not a working copy' error.
+  svntest.actions.run_and_verify_svn(None, None, not_wc % 'A',
                                      'upgrade', sbox.ospath('A'))
 
   # Now upgrade the working copy
@@ -794,10 +795,9 @@ def upgrade_tree_conflict_data(sbox):
   no_actual_node(sbox, 'A/D/G/tau')
 
   # While the upgrade from f20 to f21 will work the upgrade from f22
-  # to f23 will not, since working nodes are present, so the
-  # auto-upgrade will fail.  If this happens we cannot use the
-  # Subversion libraries to query the working copy.
-  exit_code, output, errput = svntest.main.run_svn('format 22', 'st', wc_dir)
+  # to f23 will not, since working nodes are present.
+  exit_code, output, errput = svntest.main.run_svn('format 22', 'upgrade',
+                                                    wc_dir)
 
   if not exit_code:
     run_and_verify_status_no_server(wc_dir, expected_status)
@@ -984,8 +984,8 @@ def upgrade_from_format_28(sbox):
   assert os.path.exists(old_pristine_path)
   assert not os.path.exists(new_pristine_path)
 
-  # Touch the WC to auto-upgrade it
-  svntest.actions.run_and_verify_svn(None, None, [], 'info', sbox.wc_dir)
+  # Upgrade the WC
+  svntest.actions.run_and_verify_svn(None, None, [], 'upgrade', sbox.wc_dir)
 
   assert not os.path.exists(old_pristine_path)
   assert os.path.exists(new_pristine_path)

Modified: subversion/branches/ev2-export/subversion/tests/libsvn_client/client-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/libsvn_client/client-test.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/tests/libsvn_client/client-test.c (original)
+++ subversion/branches/ev2-export/subversion/tests/libsvn_client/client-test.c Fri Nov 23 01:12:18 2012
@@ -636,8 +636,8 @@ test_16k_add(const svn_test_opts_t *opts
                                        svn_io_file_del_none,
                                        iterpool, iterpool));
 
-      SVN_ERR(svn_client_add4(path, svn_depth_unknown, FALSE, FALSE, FALSE,
-                              ctx, iterpool));
+      SVN_ERR(svn_client_add5(path, svn_depth_unknown, FALSE, FALSE, FALSE,
+                              FALSE, ctx, iterpool));
     }
 
   targets = apr_array_make(pool, 1, sizeof(const char *));
@@ -721,88 +721,6 @@ test_youngest_common_ancestor(const svn_
   return SVN_NO_ERROR;
 }
 
-static svn_error_t *
-test_externals_parse(const svn_test_opts_t *opts, apr_pool_t *pool)
-{
-  int i;
-  struct external_info
-    {
-      const char *line;
-      const char *url;
-      const char *local_path;
-      svn_revnum_t peg_rev;
-      svn_revnum_t rev;
-      
-    } items[] = {
-        {
-            "dir http://server/svn/a",
-            "http://server/svn/a",
-            "dir"
-        },
-        {
-            "/svn/home dir",
-            "u://svr/svn/home",
-            "dir"
-        },
-        {
-            "//server/home dir",
-            "u://server/home",
-            "dir"
-        },
-        {
-            "../../../../home dir",
-            "u://svr/svn/home",
-            "dir",
-        },
-        {
-            "^/../repB/tools/scripts scripts",
-            "u://svr/svn/cur/repB/tools/scripts",
-            "scripts"
-        },
-        { 
-            "^/../repB/tools/README.txt scripts/README.txt",
-            "u://svr/svn/cur/repB/tools/README.txt",
-            "scripts/README.txt"
-        },
-    };
-  
-
-  for (i = 0; i < sizeof(items) / sizeof(items[0]); i++)
-    {
-      apr_array_header_t *results;
-      svn_wc_external_item2_t *external_item;
-      const char *resolved_url;
-      SVN_ERR(svn_wc_parse_externals_description3(&results, "/my/current/dir",
-                                                  items[i].line, FALSE, pool));
-
-      SVN_TEST_ASSERT(results && results->nelts == 1);
-
-      external_item = APR_ARRAY_IDX(results, 0, svn_wc_external_item2_t *);
-
-      SVN_ERR(svn_wc__resolve_relative_external_url(&resolved_url,
-                                                    external_item,
-                                                    "u://svr/svn/cur/dir",
-                                                    "u://svr/svn/cur/dir/sd/fl",
-                                                    pool, pool));
-
-      SVN_TEST_STRING_ASSERT(resolved_url, items[i].url);
-      SVN_TEST_STRING_ASSERT(external_item->target_dir, items[i].local_path);
-
-      if (items[i].peg_rev != 0)
-        SVN_TEST_ASSERT(external_item->peg_revision.value.number
-                                == items[i].peg_rev);
-      if (items[i].rev != 0)
-        SVN_TEST_ASSERT(external_item->revision.value.number == items[i].rev);
-      SVN_TEST_ASSERT(svn_uri_is_canonical(resolved_url, pool));
-    }
-
-
-  return SVN_NO_ERROR;
-
-}
-
-
-
 
 /* ========================================================================== */
 
@@ -820,6 +738,5 @@ struct svn_test_descriptor_t test_funcs[
     SVN_TEST_OPTS_PASS(test_16k_add, "test adding 16k files"),
 #endif
     SVN_TEST_OPTS_PASS(test_youngest_common_ancestor, "test youngest_common_ancestor"),
-    SVN_TEST_OPTS_PASS(test_externals_parse, "test svn_wc_parse_externals_description3"),
     SVN_TEST_NULL
   };

Modified: subversion/branches/ev2-export/subversion/tests/libsvn_fs/fs-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/libsvn_fs/fs-test.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/tests/libsvn_fs/fs-test.c (original)
+++ subversion/branches/ev2-export/subversion/tests/libsvn_fs/fs-test.c Fri Nov 23 01:12:18 2012
@@ -3533,7 +3533,8 @@ static int my_rand(apr_uint64_t scalar, 
 {
   static const apr_uint32_t TEST_RAND_MAX = 0xffffffffUL;
   /* Assumes TEST_RAND_MAX+1 can be exactly represented in a double */
-  return (int)(((double)svn_test_rand(seed)
+  apr_uint32_t rand = svn_test_rand(seed);
+  return (int)(((double)rand
                 / ((double)TEST_RAND_MAX+1.0))
                * (double)scalar);
 }
@@ -4895,6 +4896,29 @@ node_history(const svn_test_opts_t *opts
   return SVN_NO_ERROR;
 }
 
+/* Test svn_fs_delete_fs(). */
+static svn_error_t *
+delete_fs(const svn_test_opts_t *opts,
+             apr_pool_t *pool)
+{
+  svn_fs_t *fs;
+  const char *path;
+  svn_node_kind_t kind;
+
+  SVN_ERR(svn_test__create_fs(&fs, "test-delete-fs", opts, pool));
+  path = svn_fs_path(fs, pool);
+  SVN_ERR(svn_io_check_path(path, &kind, pool));
+  SVN_TEST_ASSERT(kind != svn_node_none);
+  SVN_ERR(svn_fs_delete_fs(path, pool));
+  SVN_ERR(svn_io_check_path(path, &kind, pool));
+  SVN_TEST_ASSERT(kind == svn_node_none);
+
+  /* Recreate dir so that test cleanup doesn't fail. */
+  SVN_ERR(svn_io_dir_make(path, APR_OS_DEFAULT, pool));
+
+  return SVN_NO_ERROR;
+}
+
 
 
 /* ------------------------------------------------------------------------ */
@@ -4978,5 +5002,7 @@ struct svn_test_descriptor_t test_funcs[
                        "create and modify small file"),
     SVN_TEST_OPTS_PASS(node_history,
                        "test svn_fs_node_history"),
+    SVN_TEST_OPTS_PASS(delete_fs,
+                       "test svn_fs_delete_fs"),
     SVN_TEST_NULL
   };

Modified: subversion/branches/ev2-export/subversion/tests/libsvn_subr/dirent_uri-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/libsvn_subr/dirent_uri-test.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/tests/libsvn_subr/dirent_uri-test.c (original)
+++ subversion/branches/ev2-export/subversion/tests/libsvn_subr/dirent_uri-test.c Fri Nov 23 01:12:18 2012
@@ -886,14 +886,17 @@ static const testcase_canonicalize_t uri
     { "svn://SERVER:443/",     "svn://server:443" },
     { "file:///C%7C/temp/REPOS", "file:///C%7C/temp/REPOS" },
     { "file:///C|/temp/REPOS", "file:///C%7C/temp/REPOS" },
+    { "file:///C:/",           "file:///C:" },
 #ifdef SVN_USE_DOS_PATHS
     { "file:///c:/temp/repos", "file:///C:/temp/repos" },
     { "file:///c:/temp/REPOS", "file:///C:/temp/REPOS" },
     { "file:///C:/temp/REPOS", "file:///C:/temp/REPOS" },
+    { "file:///c:/",           "file:///C:" },
 #else /* !SVN_USE_DOS_PATHS */
     { "file:///c:/temp/repos", "file:///c:/temp/repos" },
     { "file:///c:/temp/REPOS", "file:///c:/temp/REPOS" },
     { "file:///C:/temp/REPOS", "file:///C:/temp/REPOS" },
+    { "file:///c:/",           "file:///c:" },
 #endif /* SVN_USE_DOS_PATHS */
   /* svn_uri_is_canonical() was a private function in the 1.6 API, and
      has since taken a MAJOR change of direction, namely that only
@@ -2369,7 +2372,7 @@ test_file_url_from_dirent(apr_pool_t *po
   } tests[] = {
 #ifdef SVN_USE_DOS_PATHS
     { "C:/file",                   "file:///C:/file" },
-    { "C:/",                       "file:///C:/" },
+    { "C:/",                       "file:///C:" },
     { "C:/File#$",                 "file:///C:/File%23$" },
     /* We can't check these as svn_dirent_get_absolute() won't work
        on shares that don't exist */
@@ -2396,6 +2399,8 @@ test_file_url_from_dirent(apr_pool_t *po
                                  "svn_uri_get_file_url_from_dirent(\"%s\") "
                                  "returned \"%s\" expected \"%s\"",
                                  tests[i].dirent, result, tests[i].result);
+
+      SVN_TEST_ASSERT(svn_uri_is_canonical(result, pool));
     }
 
   return SVN_NO_ERROR;

Modified: subversion/branches/ev2-export/subversion/tests/libsvn_subr/io-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/libsvn_subr/io-test.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/tests/libsvn_subr/io-test.c (original)
+++ subversion/branches/ev2-export/subversion/tests/libsvn_subr/io-test.c Fri Nov 23 01:12:18 2012
@@ -129,7 +129,7 @@ create_test_file(struct test_file_defini
   int i;
 
   if (definition->size < 5)
-    SVN_ERR_ASSERT(strlen(definition->data) >= definition->size);
+    SVN_ERR_ASSERT(strlen(definition->data) >= (apr_size_t)definition->size);
   else
     SVN_ERR_ASSERT(strlen(definition->data) >= 5);
 

Modified: subversion/branches/ev2-export/subversion/tests/libsvn_subr/path-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/libsvn_subr/path-test.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/tests/libsvn_subr/path-test.c (original)
+++ subversion/branches/ev2-export/subversion/tests/libsvn_subr/path-test.c Fri Nov 23 01:12:18 2012
@@ -21,6 +21,13 @@
  * ====================================================================
  */
 
+#ifdef _MSC_VER
+#include <direct.h>
+#define getcwd _getcwd
+#else
+#include <unistd.h> /* for getcwd() */
+#endif
+
 #include <stdio.h>
 #include <string.h>
 #include <apr_general.h>
@@ -1465,6 +1472,160 @@ test_path_internal_style(apr_pool_t *poo
 }
 
 
+/* The type of a function to be tested by condense_targets_tests_helper().
+ * Matches svn_path_condense_targets().
+ */
+typedef svn_error_t *(*condense_targets_func_t)
+                           (const char **pcommon,
+                            apr_array_header_t **pcondensed_targets,
+                            const apr_array_header_t *targets,
+                            svn_boolean_t remove_redundancies,
+                            apr_pool_t *pool);
+
+/** Executes function CONDENSE_TARGETS twice - with and without requesting the
+ * condensed targets list -  on TEST_TARGETS (comma sep. string) and compares
+ * the results with EXP_COMMON and EXP_TARGETS (comma sep. string).
+ *
+ * @note: a '%' character at the beginning of EXP_COMMON or EXP_TARGETS will
+ * be replaced by the current working directory.
+ *
+ * Returns an error if any of the comparisons fail.
+ */
+static svn_error_t *
+condense_targets_tests_helper(const char* title,
+                              const char* test_targets,
+                              const char* exp_common,
+                              const char* exp_targets,
+                              const char* func_name,
+                              condense_targets_func_t condense_targets,
+                              apr_pool_t *pool)
+{
+  apr_array_header_t *targets;
+  apr_array_header_t *condensed_targets;
+  const char *common_path, *common_path2, *curdir;
+  char *token, *iter;
+  const char *exp_common_abs = exp_common;
+  int i;
+  char buf[8192];
+
+  if (! getcwd(buf, sizeof(buf)))
+    return svn_error_create(SVN_ERR_BASE, NULL, "getcwd() failed");
+  curdir = svn_path_internal_style(buf, pool);
+
+  /* Create the target array */
+  targets = apr_array_make(pool, sizeof(test_targets), sizeof(const char *));
+  token = apr_strtok(apr_pstrdup(pool, test_targets), ",", &iter);
+  while (token)
+    {
+      APR_ARRAY_PUSH(targets, const char *) =
+        svn_path_internal_style(token, pool);
+      token = apr_strtok(NULL, ",", &iter);
+    };
+
+  /* Call the function */
+  SVN_ERR(condense_targets(&common_path, &condensed_targets, targets,
+                           TRUE, pool));
+
+  /* Verify the common part with the expected (prefix with cwd). */
+  if (*exp_common == '%')
+    exp_common_abs = apr_pstrcat(pool, curdir, exp_common + 1, (char *)NULL);
+
+  if (strcmp(common_path, exp_common_abs) != 0)
+    {
+      return svn_error_createf
+        (SVN_ERR_TEST_FAILED, NULL,
+         "%s (test %s) returned %s instead of %s",
+           func_name, title,
+           common_path, exp_common_abs);
+    }
+
+  /* Verify the condensed targets */
+  token = apr_strtok(apr_pstrdup(pool, exp_targets), ",", &iter);
+  for (i = 0; i < condensed_targets->nelts; i++)
+    {
+      const char * target = APR_ARRAY_IDX(condensed_targets, i, const char*);
+      if (token && (*token == '%'))
+        token = apr_pstrcat(pool, curdir, token + 1, (char *)NULL);
+      if (! token ||
+          (target && (strcmp(target, token) != 0)))
+        {
+          return svn_error_createf
+            (SVN_ERR_TEST_FAILED, NULL,
+             "%s (test %s) couldn't find %s in expected targets list",
+               func_name, title,
+               target);
+        }
+      token = apr_strtok(NULL, ",", &iter);
+    }
+
+  /* Now ensure it works without the pbasename */
+  SVN_ERR(condense_targets(&common_path2, NULL, targets, TRUE, pool));
+
+  /* Verify the common part again */
+  if (strcmp(common_path, common_path2) != 0)
+    {
+      return svn_error_createf
+        (SVN_ERR_TEST_FAILED, NULL,
+         "%s (test %s): Common path without getting targets %s does not match" \
+         "common path with targets %s",
+          func_name, title,
+          common_path2, common_path);
+    }
+
+  return SVN_NO_ERROR;
+}
+
+
+static svn_error_t *
+test_path_condense_targets(apr_pool_t *pool)
+{
+  int i;
+  struct {
+    const char* title;
+    const char* targets;
+    const char* exp_common;
+    const char* exp_targets;
+  } tests[] = {
+    { "normal use", "z/A/B,z/A,z/A/C,z/D/E,z/D/F,z/D,z/G,z/G/H,z/G/I",
+      "%/z", "A,D,G" },
+    {"identical dirs", "z/A,z/A,z/A,z/A",
+     "%/z/A", "" },
+    {"identical files", "z/A/file,z/A/file,z/A/file,z/A/file",
+     "%/z/A/file", "" },
+    {"single dir", "z/A",
+     "%/z/A", "" },
+    {"single file", "z/A/file",
+     "%/z/A/file", "" },
+    {"URLs", "http://host/A/C,http://host/A/C/D,http://host/A/B/D",
+     "http://host/A", "C,B/D" },
+    {"URLs with no common prefix",
+     "http://host1/A/C,http://host2/A/C/D,http://host3/A/B/D",
+     "", "http://host1/A/C,http://host2/A/C/D,http://host3/A/B/D" },
+    {"file URLs with no common prefix", "file:///A/C,file:///B/D",
+     "", "file:///A/C,file:///B/D" },
+    {"URLs with mixed protocols",
+     "http://host/A/C,file:///B/D,gopher://host/A",
+     "", "http://host/A/C,file:///B/D,gopher://host/A" },
+    {"mixed paths and URLs",
+     "z/A/B,z/A,http://host/A/C/D,http://host/A/C",
+     "", "%/z/A,http://host/A/C" },
+  };
+
+  for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
+    {
+      SVN_ERR(condense_targets_tests_helper(tests[i].title,
+                                            tests[i].targets,
+                                            tests[i].exp_common,
+                                            tests[i].exp_targets,
+                                            "svn_path_condense_targets",
+                                            svn_path_condense_targets,
+                                            pool));
+    }
+
+  return SVN_NO_ERROR;
+}
+
+
 /* local define to support XFail-ing tests on Windows/Cygwin only */
 #ifdef SVN_USE_DOS_PATHS
 #define WINDOWS_OR_CYGWIN TRUE
@@ -1526,5 +1687,7 @@ struct svn_test_descriptor_t test_funcs[
                    "test svn_path_local_style"),
     SVN_TEST_PASS2(test_path_internal_style,
                    "test svn_path_internal_style"),
+    SVN_TEST_PASS2(test_path_condense_targets,
+                   "test svn_path_condense_targets"),
     SVN_TEST_NULL
   };

Modified: subversion/branches/ev2-export/subversion/tests/libsvn_subr/stream-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/libsvn_subr/stream-test.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/tests/libsvn_subr/stream-test.c (original)
+++ subversion/branches/ev2-export/subversion/tests/libsvn_subr/stream-test.c Fri Nov 23 01:12:18 2012
@@ -576,7 +576,7 @@ test_stream_base64(apr_pool_t *pool)
    The two data writes caused the base 64 code to allocate a buffer
    that was a byte short but exactly matched a stringbuf blocksize.
    That meant the stringbuf didn't overallocate and a write beyond
-   the end of the buffer occured.
+   the end of the buffer occurred.
  */
 static svn_error_t *
 test_stream_base64_2(apr_pool_t *pool)

Modified: subversion/branches/ev2-export/subversion/tests/libsvn_subr/string-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/libsvn_subr/string-test.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/tests/libsvn_subr/string-test.c (original)
+++ subversion/branches/ev2-export/subversion/tests/libsvn_subr/string-test.c Fri Nov 23 01:12:18 2012
@@ -612,6 +612,105 @@ test_stringbuf_replace(apr_pool_t *pool)
   return expect_stringbuf_equal(a, "test hello, world!!!", pool);
 }
 
+static svn_error_t *
+test_string_similarity(apr_pool_t *pool)
+{
+  const struct sim_score_test_t
+  {
+    const char *stra;
+    const char *strb;
+    apr_size_t lcs;
+    int score;
+  } tests[] =
+      {
+#define SCORE(lcs, len) ((2000 * (lcs) + (len)/2) / (len))
+
+        /* Equality */
+        {"",       "",          0, 1000},
+        {"quoth",  "quoth",     5, SCORE(5, 5+5)},
+
+        /* Deletion at start */
+        {"quoth",  "uoth",      4, SCORE(4, 5+4)},
+        {"uoth",   "quoth",     4, SCORE(4, 4+5)},
+
+        /* Deletion at end */
+        {"quoth",  "quot",      4, SCORE(4, 5+4)},
+        {"quot",   "quoth",     4, SCORE(4, 4+5)},
+
+        /* Insertion at start */
+        {"quoth",  "Xquoth",    5, SCORE(5, 5+6)},
+        {"Xquoth", "quoth",     5, SCORE(5, 6+5)},
+
+        /* Insertion at end */
+        {"quoth",  "quothX",    5, SCORE(5, 5+6)},
+        {"quothX", "quoth",     5, SCORE(5, 6+5)},
+
+        /* Insertion in middle */
+        {"quoth",  "quoXth",    5, SCORE(5, 5+6)},
+        {"quoXth", "quoth",     5, SCORE(5, 6+5)},
+
+        /* Transposition at start */
+        {"quoth",  "uqoth",     4, SCORE(4, 5+5)},
+        {"uqoth",  "quoth",     4, SCORE(4, 5+5)},
+
+        /* Transposition at end */
+        {"quoth",  "quoht",     4, SCORE(4, 5+5)},
+        {"quoht",  "quoth",     4, SCORE(4, 5+5)},
+
+        /* Transposition in middle */
+        {"quoth",  "qutoh",     4, SCORE(4, 5+5)},
+        {"qutoh",  "quoth",     4, SCORE(4, 5+5)},
+
+        /* Difference */
+        {"quoth",  "raven",     0, SCORE(0, 5+5)},
+        {"raven",  "quoth",     0, SCORE(0, 5+5)},
+        {"x",      "",          0, SCORE(0, 1+0)},
+        {"",       "x",         0, SCORE(0, 0+1)},
+        {"",       "quoth",     0, SCORE(0, 0+5)},
+        {"quoth",  "",          0, SCORE(0, 5+0)},
+        {"quoth",  "the raven", 2, SCORE(2, 5+9)},
+        {"the raven",  "quoth", 2, SCORE(2, 5+9)},
+        {NULL, NULL}
+      };
+
+  const struct sim_score_test_t *t;
+  svn_membuf_t buffer;
+
+  svn_membuf__create(&buffer, 0, pool);
+  for (t = tests; t->stra; ++t)
+    {
+      apr_size_t lcs;
+      const unsigned int score =
+        svn_cstring__similarity(t->stra, t->strb, &buffer, &lcs);
+      /*
+      fprintf(stderr,
+              "lcs %s ~ %s score %.3f (%"APR_SIZE_T_FMT
+              ") expected %.3f (%"APR_SIZE_T_FMT"))\n",
+              t->stra, t->strb, score/1000.0, lcs, t->score/1000.0, t->lcs);
+      */
+      if (score != t->score)
+        return fail(pool, "%s ~ %s score %.3f <> expected %.3f",
+                    t->stra, t->strb, score/1000.0, t->score/1000.0);
+
+      if (lcs != t->lcs)
+        return fail(pool,
+                    "%s ~ %s lcs %"APR_SIZE_T_FMT
+                    " <> expected "APR_SIZE_T_FMT,
+                    t->stra, t->strb, lcs, t->lcs);
+    }
+
+  /* Test partial similarity */
+  {
+    const svn_string_t foo = {"svn:foo", 4};
+    const svn_string_t bar = {"svn:bar", 4};
+    if (1000 != svn_string__similarity(&foo, &bar, &buffer, NULL))
+      return fail(pool, "'%s'[:4] ~ '%s'[:4] found different",
+                  foo.data, bar.data);
+  }
+
+  return SVN_NO_ERROR;
+}
+
 /*
    ====================================================================
    If you add a new test to this file, update this array.
@@ -677,5 +776,7 @@ struct svn_test_descriptor_t test_funcs[
                    "check deletion from svn_stringbuf_t"),
     SVN_TEST_PASS2(test_stringbuf_replace,
                    "check replacement in svn_stringbuf_t"),
+    SVN_TEST_PASS2(test_string_similarity,
+                   "test string similarity scores"),
     SVN_TEST_NULL
   };

Modified: subversion/branches/ev2-export/subversion/tests/libsvn_wc/db-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/libsvn_wc/db-test.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/tests/libsvn_wc/db-test.c (original)
+++ subversion/branches/ev2-export/subversion/tests/libsvn_wc/db-test.c Fri Nov 23 01:12:18 2012
@@ -340,7 +340,7 @@ create_open(svn_wc__db_t **db,
   SVN_ERR(svn_dirent_get_absolute(local_abspath,
                                   svn_dirent_join("fake-wc", subdir, pool),
                                   pool));
-  SVN_ERR(svn_wc__db_open(db, NULL, TRUE, TRUE, pool, pool));
+  SVN_ERR(svn_wc__db_open(db, NULL, FALSE, TRUE, pool, pool));
   SVN_ERR(svn_test__create_fake_wc(*local_abspath, TESTING_DATA, pool, pool));
 
   return SVN_NO_ERROR;

Modified: subversion/branches/ev2-export/subversion/tests/libsvn_wc/entries-compat.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/libsvn_wc/entries-compat.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/tests/libsvn_wc/entries-compat.c (original)
+++ subversion/branches/ev2-export/subversion/tests/libsvn_wc/entries-compat.c Fri Nov 23 01:12:18 2012
@@ -332,7 +332,7 @@ create_open(svn_wc__db_t **db,
                                   pool));
   SVN_ERR(svn_wc__db_open(db,
                           NULL /* config */,
-                          TRUE /* auto_upgrade */,
+                          FALSE /* auto_upgrade */,
                           TRUE /* enforce_empty_wq */,
                           pool, pool));