Author: julianfoad
Date: Wed Nov 12 09:39:13 2014
New Revision: 1638728

URL: http://svn.apache.org/r1638728
Log:
On the 'move-tracking-2' branch: Tweak error handling and testing so that
both of the tests in svnmover_tests.py pass.

* subversion/libsvn_delta/compat3.c
  (repos_find_el_rev_by_path_rev): Raise an error instead of an assertion
    failure for a bad revision number.

* subversion/svnmover/svnmover.c
  (VERIFY_EID_NONEXISTENT,
   VERIFY_EID_EXISTS): Tweak error messages to be more like those 'svnmucc'
    gives.

* subversion/tests/cmdline/svnmover_tests.py
  (xtest_svnmover): Handle expected errors more like the 'run_and_verify_*'
    functions do.
  (basic_svnmover): Delete the parts associated with testing properties, as
    'svnmover' doesn't currently support property operations. Tweak the
    expected error messages.

Modified:
    subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c
    subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c
    
subversion/branches/move-tracking-2/subversion/tests/cmdline/svnmover_tests.py

Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c?rev=1638728&r1=1638727&r2=1638728&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c 
(original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c Wed 
Nov 12 09:39:13 2014
@@ -3992,7 +3992,9 @@ repos_find_el_rev_by_path_rev(svn_branch
   svn_branch_el_rev_id_t *el_rev = apr_palloc(result_pool, sizeof(*el_rev));
   const svn_branch_revision_root_t *rev_root;
 
-  SVN_ERR_ASSERT(revnum >= 0 && revnum < repos->rev_roots->nelts);
+  if (revnum < 0 || revnum >= repos->rev_roots->nelts)
+    return svn_error_createf(SVN_ERR_FS_NO_SUCH_REVISION, NULL,
+                             _("No such revision %ld"), revnum);
 
   rev_root = APR_ARRAY_IDX(repos->rev_roots, revnum, void *);
   el_rev->rev = revnum;

Modified: subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c?rev=1638728&r1=1638727&r2=1638728&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c 
(original)
+++ subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c Wed Nov 
12 09:39:13 2014
@@ -873,13 +873,13 @@ svn_branch_diff(svn_editor3_t *editor,
 #define VERIFY_EID_NONEXISTENT(op, i)                                   \
   if (el_rev[i]->eid != -1)                                             \
     return svn_error_createf(SVN_ERR_BRANCHING, NULL,                   \
-                             _("%s: '%s': already exists"),             \
+                             _("%s: Path '%s' already exists"),         \
                              op, action->path[i]);
 
 #define VERIFY_EID_EXISTS(op, i)                                        \
   if (el_rev[i]->eid == -1)                                             \
     return svn_error_createf(SVN_ERR_BRANCHING, NULL,                   \
-                             _("%s: '%s': not found"),                  \
+                             _("%s: Path '%s' not found"),              \
                              op, action->path[i]);
 
 static svn_error_t *

Modified: 
subversion/branches/move-tracking-2/subversion/tests/cmdline/svnmover_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/cmdline/svnmover_tests.py?rev=1638728&r1=1638727&r2=1638728&view=diff
==============================================================================
--- 
subversion/branches/move-tracking-2/subversion/tests/cmdline/svnmover_tests.py 
(original)
+++ 
subversion/branches/move-tracking-2/subversion/tests/cmdline/svnmover_tests.py 
Wed Nov 12 09:39:13 2014
@@ -88,20 +88,18 @@ def test_svnmover(repo_url, expected_pat
                           "     actual: %s" % (str(expected_path_changes),
                                                str(changed_paths)))
 
-def xtest_svnmover(repo_url, expected_errors, *varargs):
+def xtest_svnmover(repo_url, error_re_string, *varargs):
   """Run svnmover with the list of VARARGS arguments.  Verify that
-  its run results match the list of EXPECTED_ERRORS."""
+  its run produces an error that matches ERROR_RE_STRING."""
 
   # First, run svnmover.
   exit_code, outlines, errlines = svntest.main.run_svnmover('-U', repo_url,
                                                             *varargs)
-  errors = []
-  for line in errlines:
-    match = _err_re.match(line)
-    if match:
-      errors.append(line.rstrip('\n\r'))
-  if errors != expected_errors:
-    raise svntest.main.SVNUnmatchedError(str(errors))
+  if error_re_string:
+    if not error_re_string.startswith(".*"):
+      error_re_string = ".*(" + error_re_string + ")"
+    expected_err = svntest.verify.RegexOutput(error_re_string, match_all=False)
+    svntest.verify.verify_outputs(None, None, errlines, None, expected_err)
 
 ######################################################################
 
@@ -271,75 +269,41 @@ def basic_svnmover(sbox):
                 'rm',              'boozle/guz/svnmover-test.py',
                 'put', empty_file, 'boozle/guz/svnmover-test.py')
 
-  # revision 17
-  test_svnmover(sbox.repo_url,
-                ['R /foo/bar (from /foo/foo:16)'
-                 ], #---------
-                '-m', 'log msg',
-                'rm',                            'foo/bar',
-                'cp', '16', 'foo/foo',           'foo/bar',
-                'propset',  'testprop',  'true', 'foo/bar')
-
-  # revision 18
-  test_svnmover(sbox.repo_url,
-                ['M /foo/bar'
-                 ], #---------
-                '-m', 'log msg',
-                'propdel', 'testprop', 'foo/bar')
-
-  # revision 19
-  test_svnmover(sbox.repo_url,
-                ['M /foo/z.c',
-                 'M /foo/foo',
-                 ], #---------
-                '-m', 'log msg',
-                'propset', 'testprop', 'true', 'foo/z.c',
-                'propset', 'testprop', 'true', 'foo/foo')
-
-  # revision 20
-  test_svnmover(sbox.repo_url,
-                ['M /foo/z.c',
-                 'M /foo/foo',
-                 ], #---------
-                '-m', 'log msg',
-                'propsetf', 'testprop', empty_file, 'foo/z.c',
-                'propsetf', 'testprop', empty_file, 'foo/foo')
-
   # Expected missing revision error
   xtest_svnmover(sbox.repo_url,
-                 ["svnmover: E200004: 'a' is not a revision"
-                  ], #---------
+                 "E205000: Syntax error parsing peg revision 'a'",
+                 #---------
                  '-m', 'log msg',
                  'cp', 'a', 'b')
 
   # Expected cannot be younger error
   xtest_svnmover(sbox.repo_url,
-                 ['svnmover: E160006: No such revision 42',
-                  ], #---------
+                 "E160006: No such revision 42",
+                 #---------
                  '-m', 'log msg',
                  'cp', '42', 'a', 'b')
 
   # Expected already exists error
   xtest_svnmover(sbox.repo_url,
-                 ["svnmover: E160020: Path 'foo' already exists",
-                  ], #---------
+                 "'foo' already exists",
+                 #---------
                  '-m', 'log msg',
-                 'cp', '17', 'a', 'foo')
+                 'cp', '16', 'A', 'foo')
 
-  # Expected copy_src already exists error
+  # Expected copy-child already exists error
   xtest_svnmover(sbox.repo_url,
-                 ["svnmover: E160020: Path 'a/bar' already exists",
-                  ], #---------
+                 "'a/bar' already exists",
+                 #---------
                  '-m', 'log msg',
-                 'cp', '17', 'foo', 'a',
-                 'cp', '17', 'foo/foo', 'a/bar')
+                 'cp', '16', 'foo', 'a',
+                 'cp', '16', 'foo/foo', 'a/bar')
 
   # Expected not found error
   xtest_svnmover(sbox.repo_url,
-                 ["svnmover: E160013: Path 'a' not found in revision 17",
-                  ], #---------
+                 "'a' not found",
+                 #---------
                  '-m', 'log msg',
-                 'cp', '17', 'a', 'b')
+                 'cp', '16', 'a', 'b')
 
 
 def nested_replaces(sbox):


Reply via email to