Author: cmpilato
Date: Thu Mar 31 14:01:31 2011
New Revision: 1087302

URL: http://svn.apache.org/viewvc?rev=1087302&view=rev
Log:
Followup to r1087015, fixing some minor problems and explicitly
testing the failure mode.

* subversion/libsvn_client/switch.c
  (switch_internal): When erroring out due to unrelated resources,
    point out which resources were unrelated.

* subversion/svn/switch-cmd.c
  (svn_cl__switch): Wrap an error string with the _() macro.

* subversion/tests/cmdline/basic_tests.py
  (basic_switch): Tweak this test to first try to switch without
    --ignore-ancestry, expecting an error, before doing the original switches.

Modified:
    subversion/trunk/subversion/libsvn_client/switch.c
    subversion/trunk/subversion/svn/switch-cmd.c
    subversion/trunk/subversion/tests/cmdline/basic_tests.py

Modified: subversion/trunk/subversion/libsvn_client/switch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/switch.c?rev=1087302&r1=1087301&r2=1087302&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/switch.c (original)
+++ subversion/trunk/subversion/libsvn_client/switch.c Thu Mar 31 14:01:31 2011
@@ -195,8 +195,9 @@ switch_internal(svn_revnum_t *result_rev
                                                        target_url, target_rev,
                                                        ctx, pool));
       if (! (yc_path && SVN_IS_VALID_REVNUM(yc_rev)))
-        return svn_error_create(SVN_ERR_CLIENT_UNRELATED_RESOURCES,
-                                NULL, NULL);
+        return svn_error_createf(SVN_ERR_CLIENT_UNRELATED_RESOURCES, NULL,
+                                 _("'%s' shares no common ancestry with '%s'"),
+                                 switch_url, local_abspath);
     }
 
 

Modified: subversion/trunk/subversion/svn/switch-cmd.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/switch-cmd.c?rev=1087302&r1=1087301&r2=1087302&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/switch-cmd.c (original)
+++ subversion/trunk/subversion/svn/switch-cmd.c Thu Mar 31 14:01:31 2011
@@ -182,10 +182,10 @@ svn_cl__switch(apr_getopt_t *os,
     {
       if (err->apr_err == SVN_ERR_CLIENT_UNRELATED_RESOURCES)
         return svn_error_createf(SVN_ERR_CLIENT_UNRELATED_RESOURCES, err,
-                                 "Path '%s' does not share common version "
-                                 "control ancestry with the requested switch "
-                                 "location.  Use --ignore-ancestry to disable "
-                                 "this check.", target);
+                                 _("Path '%s' does not share common version "
+                                   "control ancestry with the requested switch 
"
+                                   "location.  Use --ignore-ancestry to "
+                                   "disable this check."), target);
       return err;
     }
 

Modified: subversion/trunk/subversion/tests/cmdline/basic_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/basic_tests.py?rev=1087302&r1=1087301&r2=1087302&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/basic_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/basic_tests.py Thu Mar 31 
14:01:31 2011
@@ -907,7 +907,13 @@ def basic_switch(sbox):
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
   expected_status.tweak('iota', switched='S')
 
-  # Do the switch and check the results in three ways.
+  # First, try the switch without the --ignore-ancestry flag,
+  # expecting failure.
+  expected_error = "svn: E195012: .*no common ancestry.*"
+  svntest.actions.run_and_verify_svn(None, None, expected_error,
+                                     'switch', gamma_url, iota_path)
+
+  # Now ignore ancestry so we can ge through this switch.
   svntest.actions.run_and_verify_switch(wc_dir, iota_path, gamma_url,
                                         expected_output,
                                         expected_disk,
@@ -961,6 +967,12 @@ def basic_switch(sbox):
     })
   expected_status.tweak('iota', 'A/D/H', switched='S')
 
+  # First, try the switch without the --ignore-ancestry flag,
+  # expecting failure.
+  expected_error = "svn: E195012: .*no common ancestry.*"
+  svntest.actions.run_and_verify_svn(None, None, expected_error,
+                                     'switch', ADG_url, ADH_path)
+
   # Do the switch and check the results in three ways.
   svntest.actions.run_and_verify_switch(wc_dir, ADH_path, ADG_url,
                                         expected_output,


Reply via email to