Author: cmpilato
Date: Fri Oct 22 20:01:59 2010
New Revision: 1026472

URL: http://svn.apache.org/viewvc?rev=1026472&view=rev
Log:
* subversion/tests/cmdline/basic_tests.py
  (uuid_regex): New.
  (basic_relocate): Expand this test a bit.

Modified:
    subversion/trunk/subversion/tests/cmdline/basic_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/basic_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/basic_tests.py?rev=1026472&r1=1026471&r2=1026472&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/basic_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/basic_tests.py Fri Oct 22 
20:01:59 2010
@@ -38,6 +38,9 @@ XFail = svntest.testcase.XFail
 Wimp = svntest.testcase.Wimp
 Item = wc.StateItem
 
+# Generic UUID-matching regular expression
+uuid_regex = re.compile(r"[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}")
+
 ######################################################################
 # Tests
 #
@@ -2595,18 +2598,43 @@ def delete_child_parent_update(sbox):
 def basic_relocate(sbox):
   "basic relocate of a wc"
   sbox.build(read_only = True)
-  repo_url = sbox.repo_url
+
   wc_dir = sbox.wc_dir
+  repo_dir = sbox.repo_dir
+  repo_url = sbox.repo_url
+  other_repo_dir, other_repo_url = sbox.add_repo_path('other')
+  shutil.copytree(repo_dir, other_repo_dir)
 
-  # Try some no-op relocations using URL prefixes.
+  def _verify_url(wc_path, url):
+    name = os.path.basename(wc_path)
+    expected = {'Path' : re.escape(wc_path),
+                'URL' : url,
+                'Repository Root' : '.*',
+                'Revision' : '.*',
+                'Node Kind' : 'directory',
+                'Repository UUID' : uuid_regex,
+              }
+    svntest.actions.run_and_verify_info([expected], wc_path)
+
+  # No-op relocation of just the scheme.
   scheme = repo_url[:repo_url.index('://')+3]
   svntest.actions.run_and_verify_svn(None, None, [], 'switch', '--relocate',
                                      scheme, scheme, wc_dir)
-  scheme = repo_url[0 : 14]
+  _verify_url(wc_dir, repo_url)
+
+  # No-op relocation of a bit more of the URL.
+  substring = repo_url[:repo_url.index('://')+7]
   svntest.actions.run_and_verify_svn(None, None, [], 'switch', '--relocate',
-                                     scheme, scheme, wc_dir)
+                                     substring, substring, wc_dir)
+  _verify_url(wc_dir, repo_url)
+  
+  # Real relocation to OTHER_REPO_URL.
+  svntest.actions.run_and_verify_svn(None, None, [], 'switch', '--relocate',
+                                     repo_url, other_repo_url, wc_dir)
+  _verify_url(wc_dir, other_repo_url)
 
-  ### Someday, try this with argv[1] != argv[2].
+  ### TODO: When testing ra_dav or ra_svn, do relocations between
+  ### those and ra_local URLs.
 
 
 ########################################################################


Reply via email to