You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2010/08/02 16:31:05 UTC

svn commit: r981523 [2/2] - in /subversion/branches/issue-2779-dev: ./ subversion/bindings/swig/python/libsvn_swig_py/ subversion/bindings/swig/python/tests/ subversion/bindings/swig/python/tests/trac/versioncontrol/tests/ subversion/include/ subversio...

Modified: subversion/branches/issue-2779-dev/subversion/svnrdump/svnrdump.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/svnrdump/svnrdump.c?rev=981523&r1=981522&r2=981523&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/svnrdump/svnrdump.c (original)
+++ subversion/branches/issue-2779-dev/subversion/svnrdump/svnrdump.c Mon Aug  2 14:31:04 2010
@@ -289,16 +289,16 @@ static svn_error_t *
 load_revisions(svn_ra_session_t *session, const char *url,
                svn_boolean_t quiet, apr_pool_t *pool)
 {
-  const svn_delta_editor_t *load_editor;
-  void *load_baton;
   apr_file_t *stdin_file;
   svn_stream_t *stdin_stream;
+  const svn_repos_parse_fns2_t *parser;
+  void *parse_baton;
 
   apr_file_open_stdin(&stdin_file, pool);
   stdin_stream = svn_stream_from_aprfile2(stdin_file, FALSE, pool);
 
-  SVN_ERR(get_load_editor(&load_editor, &load_baton, session, pool));
-  SVN_ERR(drive_load_editor(load_editor, load_baton, stdin_stream, pool));
+  SVN_ERR(get_dumpstream_loader(&parser, &parse_baton, session, pool));
+  SVN_ERR(drive_dumpstream_loader(stdin_stream, parser, parse_baton, session, pool));
 
   svn_stream_close(stdin_stream);
 

Modified: subversion/branches/issue-2779-dev/subversion/tests/cmdline/diff_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/tests/cmdline/diff_tests.py?rev=981523&r1=981522&r2=981523&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/branches/issue-2779-dev/subversion/tests/cmdline/diff_tests.py Mon Aug  2 14:31:04 2010
@@ -3367,6 +3367,8 @@ def diff_git_format_url_url(sbox):
                                      '--old', repo_url + '@1', '--new',
                                      repo_url + '@2')
 
+# Regression test for an off-by-one error when printing intermediate context
+# lines.
 def diff_prop_missing_context(sbox):
   "diff for property has missing context"
   sbox.build()
@@ -3401,16 +3403,13 @@ def diff_prop_missing_context(sbox):
              ])
   svntest.main.run_svn(None,
                        "propset", "prop", prop_val, iota_path)
-  expected_output = [
-    "Index: iota\n",
-    "===================================================================\n",
-    "--- iota\t(revision 2)\n",
-    "+++ iota\t(working copy)\n",
+  expected_output = make_diff_header(iota_path, 'revision 2', 
+                                     'working copy') + [
     "\n",
-    "Property changes on: iota\n",
+    "Property changes on: %s\n" % iota_path.replace('\\', '/'),
     "___________________________________________________________________\n",
     "Modified: prop\n",
-    "## -1,8 +1,5 ##\n",
+    "## -1,7 +1,4 ##\n",
     "-line 1\n",
     "-line 2\n",
     " line 3\n",
@@ -3560,7 +3559,7 @@ test_list = [ None,
               diff_git_format_wc_wc,
               diff_git_format_url_wc,
               diff_git_format_url_url,
-              XFail(diff_prop_missing_context),
+              diff_prop_missing_context,
               diff_prop_multiple_hunks,
               ]
 

Modified: subversion/branches/issue-2779-dev/subversion/tests/cmdline/revert_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/tests/cmdline/revert_tests.py?rev=981523&r1=981522&r2=981523&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/tests/cmdline/revert_tests.py (original)
+++ subversion/branches/issue-2779-dev/subversion/tests/cmdline/revert_tests.py Mon Aug  2 14:31:04 2010
@@ -740,20 +740,35 @@ def status_of_missing_dir_after_revert(s
   svntest.actions.run_and_verify_svn(None, expected_output, [], "revert",
                                      A_D_G_path)
 
-  expected_output = svntest.verify.UnorderedOutput(
-    ["D       " + os.path.join(A_D_G_path, "pi") + "\n",
+  deletes = [
+     "D       " + os.path.join(A_D_G_path, "pi") + "\n",
      "D       " + os.path.join(A_D_G_path, "rho") + "\n",
-     "D       " + os.path.join(A_D_G_path, "tau") + "\n"])
+     "D       " + os.path.join(A_D_G_path, "tau") + "\n"
+  ]
+  expected_output = svntest.verify.UnorderedOutput(deletes)
   svntest.actions.run_and_verify_svn(None, expected_output, [],
                                      "status", wc_dir)
 
   svntest.main.safe_rmtree(A_D_G_path)
 
-  expected_output = svntest.verify.UnorderedOutput(
-    ["!       " + A_D_G_path + "\n"])
+  expected_output = ["!       " + A_D_G_path + "\n"]
+
+  if svntest.main.wc_is_singledb(wc_dir):
+    expected_output.extend(deletes)
+
+  expected_output = svntest.verify.UnorderedOutput(expected_output)
+
   svntest.actions.run_and_verify_svn(None, expected_output, [], "status",
                                      wc_dir)
 
+  # When using single-db, we can get back to the virginal state.
+  if svntest.main.wc_is_singledb(wc_dir):
+    svntest.actions.run_and_verify_svn(None, None, [], "revert",
+                                       "-R", A_D_G_path)
+
+    expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+    svntest.actions.run_and_verify_status(wc_dir, expected_status)
+
 #----------------------------------------------------------------------
 # Test for issue #2804 with replaced directory
 def status_of_missing_dir_after_revert_replaced_with_history_dir(sbox):

Modified: subversion/branches/issue-2779-dev/subversion/tests/cmdline/svnrdump_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/tests/cmdline/svnrdump_tests.py?rev=981523&r1=981522&r2=981523&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/tests/cmdline/svnrdump_tests.py (original)
+++ subversion/branches/issue-2779-dev/subversion/tests/cmdline/svnrdump_tests.py Mon Aug  2 14:31:04 2010
@@ -53,9 +53,9 @@ def build_repos(sbox):
   # Create an empty repository.
   svntest.main.create_repos(sbox.repo_dir)
 
-def run_test(sbox, dumpfile_name):
-  """Load a dumpfile using svnadmin load, dump it with svnrdump and
-  check that the same dumpfile is produced"""
+def run_dump_test(sbox, dumpfile_name):
+  """Load a dumpfile using 'svnadmin load', dump it with 'svnrdump
+  dump' and check that the same dumpfile is produced"""
 
   # Create an empty sanbox repository
   build_repos(sbox)
@@ -64,54 +64,120 @@ def run_test(sbox, dumpfile_name):
   svnrdump_tests_dir = os.path.join(os.path.dirname(sys.argv[0]),
                                    'svnrdump_tests_data')
 
-  # Load the specified dump file into the repository
+  # Load the specified dump file into the sbox repository using
+  # svnadmin load
   svnadmin_dumpfile = open(os.path.join(svnrdump_tests_dir,
                                         dumpfile_name),
                            'rb').readlines()
 
-  # Load dumpfile_contents into the sbox repository
   svntest.actions.run_and_verify_load(sbox.repo_dir, svnadmin_dumpfile)
 
   # Create a dump file using svnrdump
   svnrdump_dumpfile = \
-      svntest.actions.run_and_verify_svnrdump(svntest.verify.AnyOutput, [], 0,
-                                              'dump', '-q', sbox.repo_url)
+      svntest.actions.run_and_verify_svnrdump(None, svntest.verify.AnyOutput,
+                                              [], 0, '-q', 'dump',
+                                              sbox.repo_url)
 
   # Compare the output from stdout
   svntest.verify.compare_and_display_lines(
     "Dump files", "DUMP", svnadmin_dumpfile, svnrdump_dumpfile)
 
+def run_load_test(sbox, dumpfile_name):
+  """Load a dumpfile using 'svnrdump load', dump it with 'svnadmin
+  dump' and check that the same dumpfile is produced"""
+
+  # Create an empty sanbox repository
+  build_repos(sbox)
+
+  # Create the revprop-change hook for this test
+  svntest.actions.enable_revprop_changes(sbox.repo_dir)
+
+  # This directory contains all the dump files
+  svnrdump_tests_dir = os.path.join(os.path.dirname(sys.argv[0]),
+                                   'svnrdump_tests_data')
+
+  # Load the specified dump file into the sbox repository using
+  # svnrdump load
+  svnrdump_dumpfile = open(os.path.join(svnrdump_tests_dir,
+                                        dumpfile_name),
+                           'rb').readlines()
+
+  # Set the UUID of the sbox repository to the UUID specified in the
+  # dumpfile ### RA layer doesn't have a set_uuid functionality
+  uuid = svnrdump_dumpfile[2].split(' ')[1][:-1]
+  svntest.actions.run_and_verify_svnadmin2("Setting UUID", None, None, 0,
+                                           'setuuid', sbox.repo_dir,
+                                           uuid)
+
+  svntest.actions.run_and_verify_svnrdump(svnrdump_dumpfile,
+                                          svntest.verify.AnyOutput,
+                                          [], 0, '-q', 'load',
+                                          sbox.repo_url)
+
+  # Create a dump file using svnadmin dump
+  svnadmin_dumpfile = svntest.actions.run_and_verify_dump(sbox.repo_dir, True)
+
+  # Compare the output from stdout
+  svntest.verify.compare_and_display_lines(
+    "Dump files", "DUMP", svnrdump_dumpfile, svnadmin_dumpfile)
+
 ######################################################################
 # Tests
 
-def basic_svnrdump(sbox):
+def basic_dump(sbox):
   "dump the standard sbox repos"
   sbox.build(read_only = True, create_wc = False)
 
   out = \
-      svntest.actions.run_and_verify_svnrdump(svntest.verify.AnyOutput, [], 0,
-                                              'dump', '-q', sbox.repo_url)
+      svntest.actions.run_and_verify_svnrdump(None, svntest.verify.AnyOutput,
+                                              [], 0, '-q', 'dump',
+                                              sbox.repo_url)
 
   if not out[0].startswith('SVN-fs-dump-format-version:'):
     raise svntest.Failure('No valid output')
 
-def revision_0(sbox):
+def revision_0_dump(sbox):
   "dump revision zero"
-  run_test(sbox, dumpfile_name = "revision-0.dump")
+  run_dump_test(sbox, "revision-0.dump")
 
-def copy_and_modify(sbox):
+def revision_0_load(sbox):
+  "load revision zero"
+  run_load_test(sbox, "revision-0.dump")
+
+# skeleton.dump repository layout
+#
+#   Projects/       (Added r1)
+#     README        (Added r2)
+#     Project-X     (Added r3)
+#     Project-Y     (Added r4)
+#     Project-Z     (Added r5)
+#     docs/         (Added r6)
+#       README      (Added r6)
+
+def skeleton_load(sbox):
+  "skeleton repository"
+  run_load_test(sbox, "skeleton.dump")
+
+def copy_and_modify_dump(sbox):
   "copy and modify"
-  run_test(sbox, "copy-and-modify.dump")
+  run_dump_test(sbox, "copy-and-modify.dump")
 
+def copy_and_modify_load(sbox):
+  "copy and modify"
+  run_load_test(sbox, "copy-and-modify.dump")
+  
 ########################################################################
 # Run the tests
 
 
 # list all tests here, starting with None:
 test_list = [ None,
-              basic_svnrdump,
-              revision_0,
-              XFail(copy_and_modify),
+              basic_dump,
+              revision_0_dump,
+              revision_0_load,
+              skeleton_load,
+              copy_and_modify_load,
+              Wimp("Need to fix headers in RA layer", copy_and_modify_dump),
              ]
 
 if __name__ == '__main__':

Modified: subversion/branches/issue-2779-dev/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/tests/cmdline/svntest/actions.py?rev=981523&r1=981522&r2=981523&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/branches/issue-2779-dev/subversion/tests/cmdline/svntest/actions.py Mon Aug  2 14:31:04 2010
@@ -276,20 +276,24 @@ def run_and_verify_load(repo_dir, dump_f
                         None, expected_stderr)
 
 
-def run_and_verify_dump(repo_dir):
+def run_and_verify_dump(repo_dir, deltas=False):
   "Runs 'svnadmin dump' and reports any errors, returning the dump content."
-  exit_code, output, errput = main.run_svnadmin('dump', repo_dir)
+  if deltas:
+    exit_code, output, errput = main.run_svnadmin('dump', '--deltas',
+                                                  repo_dir)
+  else:
+    exit_code, output, errput = main.run_svnadmin('dump', repo_dir)
   verify.verify_outputs("Missing expected output(s)", output, errput,
                         verify.AnyOutput, verify.AnyOutput)
   return output
 
 
-def run_and_verify_svnrdump(expected_stdout, expected_stderr,
-                            expected_exit, *varargs):
-  """Runs 'svnrdump' checking output and exit code, and returns output
-  on stdout"""
+def run_and_verify_svnrdump(dumpfile_content, expected_stdout,
+                            expected_stderr, expected_exit, *varargs):
+  """Runs 'svnrdump dump|load' depending on dumpfile_content and
+  reports any errors."""
+  exit_code, output, err = main.run_svnrdump(dumpfile_content, *varargs)
 
-  exit_code, output, err = main.run_svnrdump(*varargs)
   verify.verify_outputs("Unexpected output", output, err,
                         expected_stdout, expected_stderr)
   verify.verify_exit_code("Unexpected return code", exit_code, expected_exit)

Modified: subversion/branches/issue-2779-dev/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/tests/cmdline/svntest/main.py?rev=981523&r1=981522&r2=981523&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/branches/issue-2779-dev/subversion/tests/cmdline/svntest/main.py Mon Aug  2 14:31:04 2010
@@ -593,11 +593,15 @@ def run_svnlook(*varargs):
   list of lines (including line terminators)."""
   return run_command(svnlook_binary, 1, 0, *varargs)
 
-def run_svnrdump(*varargs):
+def run_svnrdump(stdin_input, *varargs):
   """Run svnrdump with VARARGS, returns exit code as int; stdout, stderr as
   list of lines (including line terminators)."""
-  return run_command(svnrdump_binary, 1, 0,
-                     *(_with_auth(_with_config_dir(varargs))))
+  if stdin_input:
+    return run_command_stdin(svnrdump_binary, 0, 1, 0, stdin_input,
+                             *(_with_auth(_with_config_dir(varargs))))
+  else:
+    return run_command(svnrdump_binary, 1, 0,
+                       *(_with_auth(_with_config_dir(varargs))))
 
 def run_svnsync(*varargs):
   """Run svnsync with VARARGS, returns exit code as int; stdout, stderr as

Modified: subversion/branches/issue-2779-dev/subversion/tests/libsvn_subr/dirent_uri-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/subversion/tests/libsvn_subr/dirent_uri-test.c?rev=981523&r1=981522&r2=981523&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/subversion/tests/libsvn_subr/dirent_uri-test.c (original)
+++ subversion/branches/issue-2779-dev/subversion/tests/libsvn_subr/dirent_uri-test.c Mon Aug  2 14:31:04 2010
@@ -2792,6 +2792,73 @@ test_file_url_from_dirent(apr_pool_t *po
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+test_dirent_is_under_root(apr_pool_t *pool)
+{
+  struct {
+    const char *base_path;
+    const char *path;
+    svn_boolean_t under_root;
+    const char *result;
+  } tests[] = {
+    { "/",        "/base",          FALSE},
+    { "/aa",      "/aa/bb",         FALSE},
+    { "/base",    "/base2",         FALSE},
+    { "/b",       "bb",             TRUE, "/b/bb"},
+    { "/b",       "../bb",          FALSE},
+    { "/b",       "r/./bb",         TRUE, "/b/r/bb"},
+    { "/b",       "r/../bb",        TRUE, "/b/bb"},
+    { "/b",       "r/../../bb",     FALSE},
+    { "/b",       "./bb",           TRUE, "/b/bb"},
+    { "/b",       ".",              TRUE, "/b"},
+    { "/b",       "",               TRUE, "/b"},
+    { "b",        "b",              TRUE, "b/b"},
+#ifdef SVN_USE_DOS_PATHS
+    { "C:/file",  "a\\d",           TRUE, "C:/file/a/d"},
+    { "C:/file",  "aa\\..\\d",      TRUE, "C:/file/d"},
+    { "C:/file",  "aa\\..\\..\\d",  FALSE},
+#else
+    { "C:/file",  "a\\d",           TRUE, "C:/file/a\\d"},
+    { "C:/file",  "aa\\..\\d",      TRUE, "C:/file/aa\\..\\d"},
+    { "C:/file",  "aa\\..\\..\\d",  TRUE, "C:/file/aa\\..\\..\\d"},
+#endif /* SVN_USE_DOS_PATHS */
+  };
+  int i;
+
+  for (i = 0; i < COUNT_OF(tests); i++)
+    {
+      svn_boolean_t under_root;
+      const char *result;
+      
+      SVN_ERR(svn_dirent_is_under_root(&under_root,
+                                       &result,
+                                       tests[i].base_path,
+                                       tests[i].path,
+                                       pool));
+
+      if (under_root != tests[i].under_root)
+        return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
+                                 "svn_dirent_is_under_root(..\"%s\", \"%s\"..)"
+                                 " returned %s expected %s.",
+                                 tests[i].base_path,
+                                 tests[i].path,
+                                 under_root ? "TRUE" : "FALSE",
+                                 tests[i].under_root ? "TRUE" : "FALSE");
+
+      if (under_root
+          && strcmp(result, tests[i].result) != 0)
+        return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
+                                 "svn_dirent_is_under_root(..\"%s\", \"%s\"..)"
+                                 " found \"%s\" expected \"%s\".",
+                                 tests[i].base_path,
+                                 tests[i].path,
+                                 result,
+                                 tests[i].result);
+    }
+
+  return SVN_NO_ERROR;
+}
+
 
 /* The test table.  */
 
@@ -2890,5 +2957,7 @@ struct svn_test_descriptor_t test_funcs[
                    "test svn_uri_get_dirent_from_file_url errors"),
     SVN_TEST_PASS2(test_file_url_from_dirent,
                    "test svn_uri_get_file_url_from_dirent"),
+    SVN_TEST_PASS2(test_dirent_is_under_root,
+                   "test svn_dirent_is_under_root"),
     SVN_TEST_NULL
   };

Modified: subversion/branches/issue-2779-dev/tools/buildbot/slaves/win32-SharpSvn/svntest-bindings.cmd
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/tools/buildbot/slaves/win32-SharpSvn/svntest-bindings.cmd?rev=981523&r1=981522&r2=981523&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/tools/buildbot/slaves/win32-SharpSvn/svntest-bindings.cmd (original)
+++ subversion/branches/issue-2779-dev/tools/buildbot/slaves/win32-SharpSvn/svntest-bindings.cmd Mon Aug  2 14:31:04 2010
@@ -29,6 +29,17 @@ IF ERRORLEVEL 1 (
   EXIT /B 0
 )
 
+PATH %PATH%;%TESTDIR%\bin
+SET result=0
+
+
+echo python win-tests.py -r -f fsfs --javahl "%TESTDIR%\tests"
+python win-tests.py -r -f fsfs --javahl "%TESTDIR%\tests"
+IF ERRORLEVEL 1 (
+  echo [python reported error %ERRORLEVEL%]
+  SET result=1
+)
+
 IF EXIST "%TESTDIR%\swig" rmdir /s /q "%TESTDIR%\swig"
 mkdir "%TESTDIR%\swig\py-release\libsvn"
 mkdir "%TESTDIR%\swig\py-release\svn"
@@ -38,16 +49,12 @@ xcopy "release\subversion\bindings\swig\
 xcopy "subversion\bindings\swig\python\*.py" "%TESTDIR%\swig\py-release\libsvn\*.py"
 xcopy "subversion\bindings\swig\python\svn\*.py" "%TESTDIR%\swig\py-release\svn\*.py"
 
-PATH %PATH%;%TESTDIR%\bin
 SET PYTHONPATH=%TESTDIR%\swig\py-release
 
-SET result=0
-
 python subversion\bindings\swig\python\tests\run_all.py
-IF ERRORLEVEL 1 SET result=1
-
-echo win-tests.py -r -f fsfs --javahl "%TESTDIR%\tests"
-win-tests.py -r -f fsfs --javahl "%TESTDIR%\tests"
-IF ERRORLEVEL 1 SET result=1
+IF ERRORLEVEL 1 (
+  echo [Python reported error %ERRORLEVEL%]
+  SET result=1
+)
 
-exit /b %RESULT%
+exit /b %result%

Modified: subversion/branches/issue-2779-dev/tools/buildbot/slaves/win32-SharpSvn/svntest-cleanup.cmd
URL: http://svn.apache.org/viewvc/subversion/branches/issue-2779-dev/tools/buildbot/slaves/win32-SharpSvn/svntest-cleanup.cmd?rev=981523&r1=981522&r2=981523&view=diff
==============================================================================
--- subversion/branches/issue-2779-dev/tools/buildbot/slaves/win32-SharpSvn/svntest-cleanup.cmd (original)
+++ subversion/branches/issue-2779-dev/tools/buildbot/slaves/win32-SharpSvn/svntest-cleanup.cmd Mon Aug  2 14:31:04 2010
@@ -51,6 +51,8 @@ POPD
 taskkill /im svn.exe /f 2> nul:
 taskkill /im svnadmin.exe /f 2> nul:
 taskkill /im svnserve.exe /f 2> nul:
+taskkill /im svnrdump.exe /f 2> nul:
+taskkill /im svnsync.exe /f 2> nul:
 taskkill /im httpd.exe /f 2> nul:
 IF EXIST "%TESTDIR%\tests\subversion\tests\cmdline\httpd\" (
   rmdir /s /q  "%TESTDIR%\tests\subversion\tests\cmdline\httpd"