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

📄 copy_tests.py

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 PY
📖 第 1 页 / 共 5 页
字号:
                                         expected_output,                                         expected_status,                                         None,                                         None, None,                                         None, None,                                         wc_dir)#----------------------------------------------------------------------# This test passes over ra_local certainly; we're adding it because at# one time it failed over ra_dav.  Specifically, it failed when# mod_dav_svn first started sending vsn-rsc-urls as "CR/path", and was# sending bogus CR/paths for items within copied subtrees.def receive_copy_in_update(sbox):  "receive a copied directory during update"  sbox.build()  wc_dir = sbox.wc_dir  # Make a backup copy of the working copy.  wc_backup = sbox.add_wc_path('backup')  svntest.actions.duplicate_dir(wc_dir, wc_backup)  # Define a zillion paths in both working copies.  G_path = os.path.join(wc_dir, 'A', 'D', 'G')  newG_path = os.path.join(wc_dir, 'A', 'B', 'newG')  newGpi_path = os.path.join(wc_dir, 'A', 'B', 'newG', 'pi')  newGrho_path = os.path.join(wc_dir, 'A', 'B', 'newG', 'rho')  newGtau_path = os.path.join(wc_dir, 'A', 'B', 'newG', 'tau')  b_newG_path = os.path.join(wc_backup, 'A', 'B', 'newG')  b_newGpi_path = os.path.join(wc_backup, 'A', 'B', 'newG', 'pi')  b_newGrho_path = os.path.join(wc_backup, 'A', 'B', 'newG', 'rho')  b_newGtau_path = os.path.join(wc_backup, 'A', 'B', 'newG', 'tau')  # Copy directory A/D to A/B/newG    svntest.actions.run_and_verify_svn(None, None, [], 'cp', G_path, newG_path)  # Created expected output tree for 'svn ci':  expected_output = svntest.wc.State(wc_dir, {    'A/B/newG' : Item(verb='Adding'),    })  # Create expected status tree.  expected_status = svntest.actions.get_virginal_state(wc_dir, 2)  expected_status.tweak(wc_rev=1)  expected_status.add({    'A/B/newG' : Item(status='  ', wc_rev=2),    'A/B/newG/pi' : Item(status='  ', wc_rev=2),    'A/B/newG/rho' : Item(status='  ', wc_rev=2),    'A/B/newG/tau' : Item(status='  ', wc_rev=2),    })  svntest.actions.run_and_verify_commit (wc_dir,                                         expected_output,                                         expected_status,                                         None,                                         None, None,                                         None, None,                                         wc_dir)  # Now update the other working copy; it should receive a full add of  # the newG directory and its contents.  # Expected output of update  expected_output = svntest.wc.State(wc_backup, {    'A/B/newG' : Item(status='A '),    'A/B/newG/pi' : Item(status='A '),    'A/B/newG/rho' : Item(status='A '),    'A/B/newG/tau' : Item(status='A '),    })  # Create expected disk tree for the update.  expected_disk = svntest.main.greek_state.copy()  expected_disk.add({    'A/B/newG' : Item(),    'A/B/newG/pi' : Item("This is the file 'pi'.\n"),    'A/B/newG/rho' : Item("This is the file 'rho'.\n"),    'A/B/newG/tau' : Item("This is the file 'tau'.\n"),    })  # Create expected status tree for the update.  expected_status = svntest.actions.get_virginal_state(wc_backup, 2)  expected_status.add({    'A/B/newG' : Item(status='  ', wc_rev=2),    'A/B/newG/pi' : Item(status='  ', wc_rev=2),    'A/B/newG/rho' : Item(status='  ', wc_rev=2),    'A/B/newG/tau' : Item(status='  ', wc_rev=2),    })  # Do the update and check the results in three ways.  svntest.actions.run_and_verify_update(wc_backup,                                        expected_output,                                        expected_disk,                                        expected_status)#----------------------------------------------------------------------# Regression test for issue #683.  In particular, this bug prevented# us from running 'svn cp -r N src_URL dst_URL' as a means of# resurrecting a deleted directory.  Also, the final 'update' at the# end of this test was uncovering a ghudson 'deleted' edge-case bug.# (In particular, re-adding G to D, when D already had a 'deleted'# entry for G.  The entry-merge wasn't overwriting the 'deleted'# attribute, and thus the newly-added G was ending up disconnected# from D.)def resurrect_deleted_dir(sbox):  "resurrect a deleted directory"  sbox.build()  wc_dir = sbox.wc_dir  # Delete directory A/D/G, commit that as r2.  svntest.actions.run_and_verify_svn(None, None, [], 'rm', '--force',                                     wc_dir + '/A/D/G')  expected_output = svntest.wc.State(wc_dir, {    'A/D/G' : Item(verb='Deleting'),    })  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)  expected_status.remove('A/D/G')  expected_status.remove('A/D/G/pi')  expected_status.remove('A/D/G/rho')  expected_status.remove('A/D/G/tau')    svntest.actions.run_and_verify_commit (wc_dir,                                         expected_output,                                         expected_status,                                         None,                                         None, None,                                         None, None,                                         wc_dir)  # Use 'svn cp -r 1 URL URL' to resurrect the deleted directory, where  # the two URLs are identical.  This used to trigger a failure.    url = svntest.main.current_repo_url + '/A/D/G'  svntest.actions.run_and_verify_svn(None, None, [], 'cp',                                     '--username', svntest.main.wc_author,                                     '--password', svntest.main.wc_passwd,                                     '-r', '1', url, url,                                     '-m', 'logmsg')  # For completeness' sake, update to HEAD, and verify we have a full  # greek tree again, all at revision 3.  expected_output = svntest.wc.State(wc_dir, {    'A/D/G'     : Item(status='A '),    'A/D/G/pi'  : Item(status='A '),    'A/D/G/rho' : Item(status='A '),    'A/D/G/tau' : Item(status='A '),    })  expected_disk = svntest.main.greek_state.copy()  expected_status = svntest.actions.get_virginal_state(wc_dir, 3)    svntest.actions.run_and_verify_update(wc_dir,                                        expected_output,                                        expected_disk,                                        expected_status)def copy_deleted_dir_into_prefix(sbox):  "copy a deleted dir to a prefix of its old path"  sbox.build()  wc_dir = sbox.wc_dir  # Delete directory A/D, commit that as r2.  svntest.actions.run_and_verify_svn(None, None, [], 'rm', '--force',                                     wc_dir + '/A/D')  expected_output = svntest.wc.State(wc_dir, {    'A/D' : Item(verb='Deleting'),    })  svntest.actions.run_and_verify_commit (wc_dir,                                         expected_output,                                         None,                                         None,                                         None, None,                                         None, None,                                         wc_dir)  # Ok, copy from a deleted URL into a prefix of that URL, this used to  # result in an assert failing.  url1 = svntest.main.current_repo_url + '/A/D/G'  url2 = svntest.main.current_repo_url + '/A/D'  svntest.actions.run_and_verify_svn(None, None, [], 'cp',                                     '--username', svntest.main.wc_author,                                     '--password', svntest.main.wc_passwd,                                     '-r', '1', url1, url2,                                     '-m', 'logmsg')#----------------------------------------------------------------------# Test that we're enforcing proper 'svn cp' overwrite behavior.  Note# that svn_fs_copy() will always overwrite its destination if an entry# by the same name already exists.  However, libsvn_client should be# doing existence checks to prevent directories from being# overwritten, and files can't be overwritten because the RA layers# are doing out-of-dateness checks during the commit.def no_copy_overwrites(sbox):  "svn cp URL URL cannot overwrite destination"  sbox.build()  wc_dir = sbox.wc_dir  fileURL1 =  svntest.main.current_repo_url + "/A/B/E/alpha"  fileURL2 =  svntest.main.current_repo_url + "/A/B/E/beta"  dirURL1  =  svntest.main.current_repo_url + "/A/D/G"  dirURL2  =  svntest.main.current_repo_url + "/A/D/H"  # Expect out-of-date failure if 'svn cp URL URL' tries to overwrite a file    svntest.actions.run_and_verify_svn("Whoa, I was able to overwrite a file!",                                     None, SVNAnyOutput,                                     'cp', fileURL1, fileURL2,                                     '--username',                                     svntest.main.wc_author,                                     '--password',                                     svntest.main.wc_passwd,                                     '-m', 'fooogle')  # Create A/D/H/G by running 'svn cp ...A/D/G .../A/D/H'  svntest.actions.run_and_verify_svn(None, None, [],                                     'cp', dirURL1, dirURL2,                                     '--username', svntest.main.wc_author,                                     '--password', svntest.main.wc_passwd,                                     '-m', 'fooogle')  # Repeat the last command.  It should *fail* because A/D/H/G already exists.  svntest.actions.run_and_verify_svn(    "Whoa, I was able to overwrite a directory!",    None, SVNAnyOutput,    'cp', dirURL1, dirURL2,    '--username', svntest.main.wc_author,    '--password', svntest.main.wc_passwd,    '-m', 'fooogle')#----------------------------------------------------------------------# Issue 845. WC -> WC copy should not overwrite base text-basedef no_wc_copy_overwrites(sbox):  "svn cp PATH PATH cannot overwrite destination"  sbox.build()  wc_dir = sbox.wc_dir  # File simply missing  tau_path = os.path.join(wc_dir, 'A', 'D', 'G', 'tau')  os.remove(tau_path)  # Status before attempting copies  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)  expected_status.tweak('A/D/G/tau', status='! ')  svntest.actions.run_and_verify_status(wc_dir, expected_status)  # These copies should fail  pi_path = os.path.join(wc_dir, 'A', 'D', 'G', 'pi')  rho_path = os.path.join(wc_dir, 'A', 'D', 'G', 'rho')  svntest.actions.run_and_verify_svn("", None, SVNAnyOutput,                                     'cp', pi_path, rho_path)  svntest.actions.run_and_verify_svn("", None, SVNAnyOutput,                                     'cp', pi_path, tau_path)  # Status after failed copies should not have changed  svntest.actions.run_and_verify_status(wc_dir, expected_status)#----------------------------------------------------------------------# Takes out working-copy locks for A/B2 and child A/B2/E. At one stage# during issue 749 the second lock cause an already-locked error.def copy_modify_commit(sbox):  "copy and tree and modify before commit"  sbox.build()  wc_dir = sbox.wc_dir    svntest.actions.run_and_verify_svn(None, None, [], 'cp',                                     wc_dir + '/A/B', wc_dir + '/A/B2')    alpha_path = os.path.join(wc_dir, 'A', 'B2', 'E', 'alpha')  svntest.main.file_append(alpha_path, "modified alpha")  expected_output = svntest.wc.State(wc_dir, {    'A/B2' : Item(verb='Adding'),    'A/B2/E/alpha' : Item(verb='Sending'),    })  svntest.actions.run_and_verify_commit (wc_dir,                                         expected_output,                                         None,                                         None,                                         None, None,                                         None, None,                                         wc_dir)#----------------------------------------------------------------------# Issue 591, at one point copying a file from URL to WC didn't copy# properties.def copy_files_with_properties(sbox):  "copy files with properties"  sbox.build()  wc_dir = sbox.wc_dir  # Set a property on a file  rho_path = os.path.join(wc_dir, 'A', 'D', 'G', 'rho')  svntest.actions.run_and_verify_svn(None, None, [],                                     'propset', 'pname', 'pval', rho_path)  # and commit it  expected_output = svntest.wc.State(wc_dir, {    'A/D/G/rho' : Item(verb='Sending'),    })  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)  expected_status.tweak('A/D/G/rho', status='  ', wc_rev=2)  svntest.actions.run_and_verify_commit(wc_dir,                                        expected_output, expected_status,                                        None, None, None, None, None,                                        wc_dir)  # Set another property, but don't commit it yet  svntest.actions.run_and_verify_svn(None, None, [],                                     'propset', 'pname2', 'pval2', rho_path)  # WC to WC copy of file with committed and uncommitted properties  rho_wc_path = os.path.join(wc_dir, 'A', 'D', 'G', 'rho_wc')  svntest.actions.run_and_verify_svn(None, None, [],                                     'copy', rho_path, rho_wc_path)  # REPOS to WC copy of file with properties  rho_url_path = os.path.join(wc_dir, 'A', 'D', 'G', 'rho_url')  rho_url = svntest.main.current_repo_url + '/A/D/G/rho'  svntest.actions.run_and_verify_svn(None, None, [],                                     'copy', rho_url, rho_url_path)

⌨️ 快捷键说明

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