⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 copy_tests.py

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 PY
📖 第 1 页 / 共 5 页
字号:
    'A/D/B/E/alpha' : Item(status='  ', copied='+', wc_rev='-'),    'A/D/B/F'       : Item(status='  ', copied='+', wc_rev='-'),    })  svntest.actions.run_and_verify_status (wc_dir, expected_output)#----------------------------------------------------------------------# Issue 1084: ra_svn move/copy bugdef copy_to_root(sbox):  'copy item to root of repository'  sbox.build(create_wc = False)  root = svntest.main.current_repo_url  mu = root + '/A/mu'  svntest.actions.run_and_verify_svn(None, None, [], 'cp',                                     '--username', svntest.main.wc_author,                                     '--password', svntest.main.wc_passwd,                                     '-m', '',                                     mu, root)#----------------------------------------------------------------------def url_copy_parent_into_child(sbox):  "copy URL URL/subdir"  sbox.build()  wc_dir = sbox.wc_dir    B_url = svntest.main.current_repo_url + "/A/B"  F_url = svntest.main.current_repo_url + "/A/B/F"  # Issue 1367 parent/child URL-to-URL was rejected.  svntest.actions.run_and_verify_svn(None,                                     ['\n', 'Committed revision 2.\n'], [],                                     'cp',                                     '--username', svntest.main.wc_author,                                     '--password', svntest.main.wc_passwd,                                     '-m', 'a can of worms',                                     B_url, F_url)  # Do an update to verify the copy worked  expected_output = svntest.wc.State(wc_dir, {    'A/B/F/B'         : Item(status='A '),    'A/B/F/B/E'       : Item(status='A '),    'A/B/F/B/E/alpha' : Item(status='A '),    'A/B/F/B/E/beta'  : Item(status='A '),    'A/B/F/B/F'       : Item(status='A '),    'A/B/F/B/lambda'  : Item(status='A '),    })  expected_disk = svntest.main.greek_state.copy()  expected_disk.add({    'A/B/F/B'         : Item(),    'A/B/F/B/E'       : Item(),    'A/B/F/B/E/alpha' : Item("This is the file 'alpha'.\n"),    'A/B/F/B/E/beta'  : Item("This is the file 'beta'.\n"),    'A/B/F/B/F'       : Item(),    'A/B/F/B/lambda'  : Item("This is the file 'lambda'.\n"),    })  expected_status = svntest.actions.get_virginal_state(wc_dir, 2)  expected_status.add({    'A/B/F/B'         : Item(status='  ', wc_rev=2),    'A/B/F/B/E'       : Item(status='  ', wc_rev=2),    'A/B/F/B/E/alpha' : Item(status='  ', wc_rev=2),    'A/B/F/B/E/beta'  : Item(status='  ', wc_rev=2),    'A/B/F/B/F'       : Item(status='  ', wc_rev=2),    'A/B/F/B/lambda'  : Item(status='  ', wc_rev=2),    })  svntest.actions.run_and_verify_update(wc_dir,                                        expected_output,                                        expected_disk,                                        expected_status)#----------------------------------------------------------------------def wc_copy_parent_into_child(sbox):  "copy WC URL/subdir"  sbox.build()  wc_dir = sbox.wc_dir    B_url = svntest.main.current_repo_url + "/A/B"  F_B_url = svntest.main.current_repo_url + "/A/B/F/B"  # Want a smaller WC  svntest.main.safe_rmtree(wc_dir)  svntest.actions.run_and_verify_svn(None, None, [],                                     'checkout',                                     '--username', svntest.main.wc_author,                                     '--password', svntest.main.wc_passwd,                                     B_url, wc_dir)  # Issue 1367: A) copying '.' to URL failed with a parent/child  # error, and also B) copying root of a working copy attempted to  # lock the non-working copy parent directory.  was_cwd = os.getcwd()  os.chdir(sbox.wc_dir)  try:    svntest.actions.run_and_verify_svn(None,                                       ['\n', 'Committed revision 2.\n'], [],                                       'cp',                                       '--username', svntest.main.wc_author,                                       '--password', svntest.main.wc_passwd,                                       '-m', 'a larger can',                                       '.', F_B_url)  finally:    os.chdir(was_cwd)  # Do an update to verify the copy worked  expected_output = svntest.wc.State(wc_dir, {    'F/B'         : Item(status='A '),    'F/B/E'       : Item(status='A '),    'F/B/E/alpha' : Item(status='A '),    'F/B/E/beta'  : Item(status='A '),    'F/B/F'       : Item(status='A '),    'F/B/lambda'  : Item(status='A '),    })  expected_disk = svntest.wc.State('', {    'E'           : Item(),    'E/alpha'     : Item("This is the file 'alpha'.\n"),    'E/beta'      : Item("This is the file 'beta'.\n"),    'F'           : Item(),    'lambda'      : Item("This is the file 'lambda'.\n"),    'F/B'         : Item(),    'F/B/E'       : Item(),    'F/B/E/alpha' : Item("This is the file 'alpha'.\n"),    'F/B/E/beta'  : Item("This is the file 'beta'.\n"),    'F/B/F'       : Item(),    'F/B/lambda'  : Item("This is the file 'lambda'.\n"),    })  expected_status = svntest.wc.State(wc_dir, {    ''            : Item(status='  ', wc_rev=2),    'E'           : Item(status='  ', wc_rev=2),    'E/alpha'     : Item(status='  ', wc_rev=2),    'E/beta'      : Item(status='  ', wc_rev=2),    'F'           : Item(status='  ', wc_rev=2),    'lambda'      : Item(status='  ', wc_rev=2),    'F/B'         : Item(status='  ', wc_rev=2),    'F/B/E'       : Item(status='  ', wc_rev=2),    'F/B/E/alpha' : Item(status='  ', wc_rev=2),    'F/B/E/beta'  : Item(status='  ', wc_rev=2),    'F/B/F'       : Item(status='  ', wc_rev=2),    'F/B/lambda'  : Item(status='  ', wc_rev=2),    })  svntest.actions.run_and_verify_update(wc_dir,                                        expected_output,                                        expected_disk,                                        expected_status)#----------------------------------------------------------------------# Issue 1419: at one point ra_dav->get_uuid() was failing on a# non-existent public URL, which prevented us from resurrecting files# (svn cp -rOLD URL wc).def resurrect_deleted_file(sbox):  "resurrect a deleted file"  sbox.build()  wc_dir = sbox.wc_dir  # Delete a file in the repository via immediate commit  rho_url = svntest.main.current_repo_url + '/A/D/G/rho'  svntest.actions.run_and_verify_svn(None, None, [],                                     'rm', rho_url, '-m', 'rev 2')  # Update the wc to HEAD (r2)  expected_output = svntest.wc.State(wc_dir, {    'A/D/G/rho' : Item(status='D '),    })  expected_disk = svntest.main.greek_state.copy()  expected_disk.remove('A/D/G/rho')  expected_status = svntest.actions.get_virginal_state(wc_dir, 2)  expected_status.remove('A/D/G/rho')  svntest.actions.run_and_verify_update(wc_dir,                                        expected_output,                                        expected_disk,                                        expected_status)  # repos->wc copy, to resurrect deleted file.  svntest.actions.run_and_verify_svn("Copy error:", None, [],                                     'cp', '-r', '1', rho_url, wc_dir)  # status should now show the file scheduled for addition-with-history  expected_status.add({    'rho' : Item(status='A ', copied='+', wc_rev='-'),    })  svntest.actions.run_and_verify_status (wc_dir, expected_status)#-------------------------------------------------------------# Regression tests for Issue #1297:# svn diff failed after a repository to WC copy of a single file# This test checks just that.def diff_repos_to_wc_copy(sbox):  "copy file from repos to working copy and run diff"  sbox.build()  wc_dir = sbox.wc_dir    iota_repos_path = svntest.main.current_repo_url + '/iota'  target_wc_path = os.path.join(wc_dir, 'new_file')  # Copy a file from the repository to the working copy.  svntest.actions.run_and_verify_svn(None, None, [], 'cp',                                      iota_repos_path, target_wc_path)  # Run diff.  svntest.actions.run_and_verify_svn(None, None, [], 'diff', wc_dir) #-------------------------------------------------------------def repos_to_wc_copy_eol_keywords(sbox):  "repos->WC copy with keyword or eol property set"  # See issue #1473: repos->wc copy would seg fault if svn:keywords or  # svn:eol were set on the copied file, because we'd be querying an  # entry for keyword values when the entry was still null (because  # not yet been fully installed in the wc).  sbox.build()  wc_dir = sbox.wc_dir    iota_repos_path = svntest.main.current_repo_url + '/iota'  iota_wc_path = os.path.join(wc_dir, 'iota')  target_wc_path = os.path.join(wc_dir, 'new_file')  # Modify iota to make it checkworthy.  f = open(iota_wc_path, "ab")  f.write("Hello\nSubversion\n$LastChangedRevision$\n")  f.close()  svntest.actions.run_and_verify_svn(None, None, [],                                     'propset', 'svn:eol-style',                                     'CRLF', iota_wc_path)  svntest.actions.run_and_verify_svn(None, None, [],                                     'propset', 'svn:keywords',                                     'Rev', iota_wc_path)  svntest.actions.run_and_verify_svn(None, None, [],                                     'commit', '-m', 'log msg',                                     wc_dir)  # Copy a file from the repository to the working copy.  svntest.actions.run_and_verify_svn(None, None, [], 'cp',                                      iota_repos_path, target_wc_path)  # The original bug was that the copy would seg fault.  So we test  # that the copy target exists now; if it doesn't, it's probably  # because of the segfault.  Note that the crash would be independent  # of whether there are actually any line breaks or keywords in the  # file's contents -- the mere existence of the property would  # trigger the bug.  if not os.path.exists(target_wc_path):    raise svntest.Failure  # Okay, if we got this far, we might as well make sure that the  # translations/substitutions were done correctly:  f = open(target_wc_path, "rb")  raw_contents = f.read()  f.seek(0, 0)  line_contents = f.readlines()  f.close()  if re.match('[^\\r]\\n', raw_contents):    raise svntest.Failure  if not re.match('.*\$LastChangedRevision:\s*\d+\s*\$', line_contents[3]):    raise svntest.Failure#-------------------------------------------------------------# Regression test for revision 7331, with commented-out parts for a further# similar bug.def revision_kinds_local_source(sbox):  "revision-kind keywords with non-URL source"  sbox.build()  wc_dir = sbox.wc_dir  mu_path = os.path.join(wc_dir, 'A', 'mu')  # Make a file with different content in each revision and WC; BASE != HEAD.  expected_output = svntest.wc.State(wc_dir, {    'A/mu' : Item(verb='Sending'), })  svntest.main.file_append(mu_path, "New r2 text.\n")  svntest.actions.run_and_verify_commit(wc_dir, expected_output, None,                                        None, None, None, None, None, wc_dir)  svntest.main.file_append(mu_path, "New r3 text.\n")  svntest.actions.run_and_verify_commit(wc_dir, expected_output, None,                                        None, None, None, None, None, wc_dir)  svntest.actions.run_and_verify_svn(None, None, [], 'up', '-r2', mu_path)  svntest.main.file_append(mu_path, "Working copy.\n")  r1 = "This is the file 'mu'.\n"  r2 = r1 + "New r2 text.\n"  r3 = r2 + "New r3 text.\n"  rWC = r2 + "Working copy.\n"  expected_disk = svntest.main.greek_state.copy()  expected_disk.tweak('A/mu', contents=rWC)  # Test the various revision-kind keywords, and none.  sub_tests = [ ('file0', 2, rWC, None),                ('file1', 3, r3, '-rHEAD'),                # ('file2', 2, r2, '-rBASE'),                # ('file3', 2, r2, '-rCOMMITTED'),                # ('file4', 1, r1, '-rPREV'),              ]  for dst, from_rev, text, rev_arg in sub_tests:    dst_path = os.path.join(wc_dir, dst)     if rev_arg is None:      svntest.actions.run_and_verify_svn(None, None, [], "copy",                                         mu_path, dst_path)    else:      svntest.actions.run_and_verify_svn(None, None, [], "copy", rev_arg,                                         mu_path, dst_path)    expected_disk.add({ dst: Item(contents=text) })    # Check that the copied-from revision == from_rev.    output, errput = svntest.main.run_svn(None, "info", dst_path)    for line in output:      if line.rstrip() == "Copied From Rev: " + str(from_rev):        break    else:      print dst, "should have been copied from revision", from_rev      raise svntest.Failure  # Check that the new files have the right contents  actual_disk = svntest.tree.build_tree_from_wc(wc_dir)  svntest.tree.compare_trees(actual_disk, expected_disk.old_tree())#-------------------------------------------------------------# Regression test for issue 1581.def copy_over_missing_file(sbox):  "copy over a missing file"  sbox.build()  wc_dir = sbox.wc_dir    mu_path = os.path.join(wc_dir, 'A', 'mu')  iota_path = os.path.join(wc_dir, 'iota')  iota_url = svntest.main.current_repo_url + "/iota"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -