Hi Stefan!

This is supposed to be a backport. It is diffed against 1.6.x.

make check passed.

[[[
Fix issue #3390, relative externals not updated during switch. 

* subversion/libsvn_client/switch.c
  (svn_client__switch_internal): Pass in a traversal_info to
    svn_wc_crawl_revision4().

* subversion/tests/cmdline/externals_tests.py
  (switch_relative_external): New.
  (test_list): Add new test.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>
]]]

Daniel
Index: subversion/tests/cmdline/externals_tests.py
===================================================================
--- subversion/tests/cmdline/externals_tests.py	(revision 902095)
+++ subversion/tests/cmdline/externals_tests.py	(arbetskopia)
@@ -18,6 +18,7 @@
 
 # General modules
 import sys
+import re
 import os
 import warnings
 
@@ -1198,7 +1199,52 @@
                                         None, None, None, None, None,
                                         True)
 
+########################################################################
 
+# Issue #3351.
+def switch_relative_external(sbox):
+  "switch a relative external"
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+  repo_url = sbox.repo_url
+
+  # Create a relative external in A/D on ../B
+  A_path = os.path.join(wc_dir, 'A')
+  A_copy_path = os.path.join(wc_dir, 'A_copy')
+  A_copy_url = repo_url + '/A_copy'
+  D_path = os.path.join(A_path, 'D')
+  ext_path = os.path.join(D_path, 'ext')
+  externals_prop = "../B ext\n"
+  change_external(D_path, externals_prop)
+  svntest.actions.run_and_verify_svn(None, None, [],
+                                     'ci', '-m', 'log msg',
+                                     '--quiet', wc_dir)
+
+  # Update our working copy, and create a "branch" (A => A_copy)
+  svntest.actions.run_and_verify_svn(None, None, [], 'up',
+                                     '--quiet', wc_dir)
+  svntest.actions.run_and_verify_svn(None, None, [], 'cp',
+                                     '--quiet', A_path, A_copy_path)
+  svntest.actions.run_and_verify_svn(None, None, [],
+                                     'ci', '-m', 'log msg',
+                                     '--quiet', wc_dir)
+
+  # Okay.  We now want to switch A to A_copy, which *should* cause
+  # A/D/ext to point to the URL for A_copy/D/ext.
+  svntest.actions.run_and_verify_svn(None, None, [], 'sw',
+                                     '--quiet', A_copy_url, A_path)
+
+  expected_infos = [
+    { 'Path' : re.escape(D_path),
+      'URL' : sbox.repo_url + '/A_copy/D',
+      },
+    { 'Path' : re.escape(ext_path),
+      'URL' : sbox.repo_url + '/A_copy/B',
+      },
+    ]
+  svntest.actions.run_and_verify_info(expected_infos, D_path, ext_path)
+
 ########################################################################
 # Run the tests
 
@@ -1223,6 +1269,7 @@
               can_place_file_external_into_dir_external,
               external_into_path_with_spaces,
               binary_file_externals,
+              switch_relative_external,
              ]
 
 if __name__ == '__main__':
Index: subversion/libsvn_client/switch.c
===================================================================
--- subversion/libsvn_client/switch.c	(revision 902095)
+++ subversion/libsvn_client/switch.c	(arbetskopia)
@@ -218,15 +218,16 @@
      PATH.  When we call reporter->finish_report, the update_editor
      will be driven by svn_repos_dir_delta2.
 
-     We pass NULL for traversal_info because this is a switch, not an
-     update, and therefore we don't want to handle any externals
-     except the ones directly affected by the switch. */
+     We pass in a traversal_info for recording all externals. It
+     shouldn't be needed for a switch if it wasn't for the relative
+     externals of type '../path'. All of those must be resolved to 
+     the new location.  */
   err = svn_wc_crawl_revisions4(path, dir_access, reporter, report_baton,
                                 TRUE, depth, (! depth_is_sticky),
                                 (! server_supports_depth),
                                 use_commit_times,
                                 ctx->notify_func2, ctx->notify_baton2,
-                                NULL, /* no traversal info */
+                                traversal_info, 
                                 pool);
 
   if (err)

Reply via email to