def relocate_with_relative_externals(sbox):
  "relocate a directory containing relative externals"

  sbox.build()
  wc_dir = sbox.wc_dir

  # Add a relative external.
  change_external(os.path.join(wc_dir, 'A', 'B'),
                  "^/A/D/G G-ext\n../D/H H-ext", commit=True)
  svntest.actions.run_and_verify_svn(None, None, [], 'update', wc_dir)

  # Move our repository to another location.
  repo_dir = sbox.repo_dir
  repo_url = sbox.repo_url
  other_repo_dir, other_repo_url = sbox.add_repo_path('other')
  svntest.main.copy_repos(repo_dir, other_repo_dir, 2, 0)
  svntest.main.safe_rmtree(repo_dir, 1)

  # Now relocate our working copy.
  svntest.actions.run_and_verify_svn(None, None, [], 'relocate',
                                     repo_url, other_repo_url, wc_dir)

  # Check the URLs of the externals -- were they updated to point to the
  # .other repository URL?
  svntest.actions.run_and_verify_info([{ 'URL' : '.*.other/A/D/G$' }],
                                      os.path.join(wc_dir, 'A', 'B', 'G-ext'))
  svntest.actions.run_and_verify_info([{ 'URL' : '.*.other/A/D/H$' }],
                                      os.path.join(wc_dir, 'A', 'B', 'H-ext'))
Example #2
0
def relocate_with_relative_externals(sbox):
    "relocate a directory containing relative externals"

    sbox.build()
    wc_dir = sbox.wc_dir

    # Add a relative external.
    change_external(os.path.join(wc_dir, 'A', 'B'),
                    "^/A/D/G G-ext\n../D/H H-ext",
                    commit=True)
    svntest.actions.run_and_verify_svn(None, None, [], 'update', wc_dir)

    # Move our repository to another location.
    repo_dir = sbox.repo_dir
    repo_url = sbox.repo_url
    other_repo_dir, other_repo_url = sbox.add_repo_path('other')
    svntest.main.copy_repos(repo_dir, other_repo_dir, 2, 0)
    svntest.main.safe_rmtree(repo_dir, 1)

    # Now relocate our working copy.
    svntest.actions.run_and_verify_svn(None, None, [], 'relocate', repo_url,
                                       other_repo_url, wc_dir)

    # Check the URLs of the externals -- were they updated to point to the
    # .other repository URL?
    svntest.actions.run_and_verify_info([{
        'URL': '.*.other/A/D/G$'
    }], os.path.join(wc_dir, 'A', 'B', 'G-ext'))
    svntest.actions.run_and_verify_info([{
        'URL': '.*.other/A/D/H$'
    }], os.path.join(wc_dir, 'A', 'B', 'H-ext'))