📄 update_tests.py
字号:
svntest.main.safe_rmtree(E_path) svntest.main.safe_rmtree(H_path) # Create expected output tree for an update of the missing items by name expected_output = svntest.wc.State(wc_dir, { 'A/B/E' : Item(status='D '), 'A/D/H' : Item(status='D '), }) # Create expected disk tree for the update. expected_disk = svntest.main.greek_state.copy() expected_disk.remove('A/B/E', 'A/B/E/alpha', 'A/B/E/beta') expected_disk.remove('A/D/H', 'A/D/H/chi', 'A/D/H/omega', 'A/D/H/psi') # Create expected status tree for the update. expected_status = svntest.actions.get_virginal_state(wc_dir, 2) expected_status.remove('A/B/E', 'A/B/E/alpha', 'A/B/E/beta') expected_status.remove('A/D/H', 'A/D/H/chi', 'A/D/H/omega', 'A/D/H/psi') expected_status.tweak(wc_rev=1) # Do the update, specifying the deleted paths explicitly. svntest.actions.run_and_verify_update(wc_dir, expected_output, expected_disk, expected_status, None, None, None, None, None, 0, "-r", "2", E_path, H_path) # Update back to the old revision again svntest.main.run_svn(None, 'up', '-r', '1', wc_dir) # Delete the directories from disk svntest.main.safe_rmtree(E_path) svntest.main.safe_rmtree(H_path) # This time we're updating the whole working copy expected_status.tweak(wc_rev=2) # Do the update, on the whole working copy this time svntest.actions.run_and_verify_update(wc_dir, expected_output, expected_disk, expected_status, None, None, None, None, None, 0, "-r", "2", wc_dir)#----------------------------------------------------------------------# Issue 919. This test was written as a regression test for "item# should remain 'deleted' when an update deletes a sibling".def another_hudson_problem(sbox): "another \"hudson\" problem: updates that delete" sbox.build() wc_dir = sbox.wc_dir # Delete/commit gamma thus making it 'deleted' gamma_path = os.path.join(wc_dir, 'A', 'D', 'gamma') svntest.main.run_svn(None, 'rm', gamma_path) expected_output = svntest.wc.State(wc_dir, { 'A/D/gamma' : Item(verb='Deleting'), }) expected_status = svntest.actions.get_virginal_state(wc_dir, 2) expected_status.tweak(wc_rev=1) expected_status.remove('A/D/gamma') svntest.actions.run_and_verify_commit (wc_dir, expected_output, expected_status, None, None, None, None, None, wc_dir) # Delete directory G from the repository svntest.actions.run_and_verify_svn(None, ['\n', 'Committed revision 3.\n'], [], 'rm', '-m', 'log msg', svntest.main.current_repo_url + '/A/D/G') # Remove corresponding tree from working copy G_path = os.path.join(wc_dir, 'A', 'D', 'G') svntest.main.safe_rmtree(G_path) # Update missing directory to receive the delete, this should mark G # as 'deleted' and should not alter gamma's entry. # Sigh, I can't get run_and_verify_update to work (but not because # of issue 919 as far as I can tell) svntest.actions.run_and_verify_svn(None, ['D '+G_path+'\n', 'Updated to revision 3.\n'], [], 'up', G_path) # Both G and gamma should be 'deleted', update should produce no output expected_output = svntest.wc.State(wc_dir, { }) expected_status = svntest.actions.get_virginal_state(wc_dir, 3) expected_status.remove('A/D/G', 'A/D/G/pi', 'A/D/G/rho', 'A/D/G/tau', 'A/D/gamma') expected_disk = svntest.main.greek_state.copy() expected_disk.remove('A/D/G', 'A/D/G/pi', 'A/D/G/rho', 'A/D/G/tau', 'A/D/gamma') svntest.actions.run_and_verify_update(wc_dir, expected_output, expected_disk, expected_status) #----------------------------------------------------------------------def update_deleted_targets(sbox): "explicit update of deleted=true targets" sbox.build() wc_dir = sbox.wc_dir # Delete/commit thus creating 'deleted=true' entries gamma_path = os.path.join(wc_dir, 'A', 'D', 'gamma') F_path = os.path.join(wc_dir, 'A', 'B', 'F') svntest.main.run_svn(None, 'rm', gamma_path, F_path) expected_output = svntest.wc.State(wc_dir, { 'A/D/gamma' : Item(verb='Deleting'), 'A/B/F' : Item(verb='Deleting'), }) expected_status = svntest.actions.get_virginal_state(wc_dir, 2) expected_status.tweak(wc_rev=1) expected_status.remove('A/D/gamma', 'A/B/F') svntest.actions.run_and_verify_commit (wc_dir, expected_output, expected_status, None, None, None, None, None, wc_dir) # Explicit update must not remove the 'deleted=true' entries svntest.actions.run_and_verify_svn(None, ['At revision 2.\n'], [], 'update', gamma_path) svntest.actions.run_and_verify_svn(None, ['At revision 2.\n'], [], 'update', F_path) # Update to r1 to restore items, since the parent directory is already # at r1 this fails if the 'deleted=true' entries are missing (issue 2250) expected_output = svntest.wc.State(wc_dir, { 'A/D/gamma' : Item(status='A '), 'A/B/F' : Item(status='A '), }) expected_status = svntest.actions.get_virginal_state(wc_dir, 2) expected_disk = svntest.main.greek_state.copy() expected_status.tweak(wc_rev=1) svntest.actions.run_and_verify_update(wc_dir, expected_output, expected_disk, expected_status, None, None, None, None, None, 0, '-r', '1', wc_dir) #----------------------------------------------------------------------def new_dir_with_spaces(sbox): "receive new dir with spaces in its name" sbox.build() wc_dir = sbox.wc_dir # Create a new directory ("spacey dir") directly in repository svntest.actions.run_and_verify_svn(None, ['\n', 'Committed revision 2.\n'], [], 'mkdir', '-m', 'log msg', svntest.main.current_repo_url + '/A/spacey%20dir') # Update, and make sure ra_dav doesn't choke on the space. expected_output = svntest.wc.State(wc_dir, { 'A/spacey dir' : Item(status='A '), }) expected_status = svntest.actions.get_virginal_state(wc_dir, 2) expected_status.add({ 'A/spacey dir' : Item(status=' ', wc_rev=2), }) expected_disk = svntest.main.greek_state.copy() expected_disk.add({ 'A/spacey dir' : Item(), }) svntest.actions.run_and_verify_update(wc_dir, expected_output, expected_disk, expected_status) #----------------------------------------------------------------------def non_recursive_update(sbox): "non-recursive update" sbox.build() wc_dir = sbox.wc_dir # Commit a change to A/mu and A/D/G/rho mu_path = os.path.join(wc_dir, 'A', 'mu') rho_path = os.path.join(wc_dir, 'A', 'D', 'G', 'rho') svntest.main.file_append(mu_path, "new") svntest.main.file_append(rho_path, "new") expected_output = svntest.wc.State(wc_dir, { 'A/mu' : Item(verb='Sending'), 'A/D/G/rho' : Item(verb='Sending'), }) expected_status = svntest.actions.get_virginal_state(wc_dir, 2) expected_status.tweak(wc_rev=1) expected_status.tweak('A/mu', 'A/D/G/rho', wc_rev=2) svntest.actions.run_and_verify_commit (wc_dir, expected_output, expected_status, None, None, None, None, None, wc_dir) # Update back to revision 1 expected_output = svntest.wc.State(wc_dir, { 'A/mu' : Item(status='U '), 'A/D/G/rho' : Item(status='U '), }) expected_disk = svntest.main.greek_state.copy() expected_status.tweak('A/mu', 'A/D/G/rho', wc_rev=1) svntest.actions.run_and_verify_update(wc_dir, expected_output, expected_disk, expected_status, None, None, None, None, None, 0, '-r', '1', wc_dir) # Non-recursive update of A should change A/mu but not A/D/G/rho A_path = os.path.join(wc_dir, 'A') expected_output = svntest.wc.State(wc_dir, { 'A/mu' : Item(status='U '), }) expected_status.tweak('A', 'A/mu', wc_rev=2) expected_disk.tweak('A/mu', contents="This is the file 'mu'.\nnew") svntest.actions.run_and_verify_update(wc_dir, expected_output, expected_disk, expected_status, None, None, None, None, None, 0, '-N', A_path)#----------------------------------------------------------------------def checkout_empty_dir(sbox): "check out an empty dir" # See issue #1472 -- checked out empty dir should not be marked as # incomplete ("!" in status). sbox.build() wc_dir = sbox.wc_dir C_url = svntest.main.current_repo_url + '/A/C' svntest.main.safe_rmtree(wc_dir) svntest.actions.run_and_verify_svn(None, None, [], 'checkout', C_url, wc_dir) svntest.actions.run_and_verify_svn(None, [], [], 'status', wc_dir)#----------------------------------------------------------------------# Regression test for issue #919: "another ghudson bug". Basically, if# we fore- or back-date an item until it no longer exists, we were# completely removing the entry, rather than marking it 'deleted'# (which we now do.)def update_to_deletion(sbox): "update target till it's gone, then get it back" sbox.build() wc_dir = sbox.wc_dir iota_path = os.path.join(wc_dir, 'iota') # Update iota to rev 0, so it gets removed. expected_output = svntest.wc.State(wc_dir, { 'iota' : Item(status='D '), }) expected_disk = svntest.main.greek_state.copy() expected_disk.remove('iota') svntest.actions.run_and_verify_update(wc_dir, expected_output, expected_disk, None, None, None, None, None, None, 0, '-r', '0', iota_path) # Update the wc root, so iota comes back. expected_output = svntest.wc.State(wc_dir, { 'iota' : Item(status='A '), }) expected_disk = svntest.main.greek_state.copy() svntest.actions.run_and_verify_update(wc_dir, expected_output, expected_disk, None, None, None, None, None, None, 0, wc_dir) #----------------------------------------------------------------------def update_deletion_inside_out(sbox): "update child before parent of a deleted tree" sbox.build() wc_dir = sbox.wc_dir parent_path = os.path.join(wc_dir, 'A', 'B') child_path = os.path.join(parent_path, 'E') # Could be a file, doesn't matter # Delete the parent directory. svntest.actions.run_and_verify_svn(None, None, [], 'rm', parent_path) svntest.actions.run_and_verify_svn(None, None, [], 'ci', '-m', '', wc_dir) # Update back to r1. svntest.actions.run_and_verify_svn(None, None, [], 'update', '-r', '1', wc_dir) # Update just the child to r2. svntest.actions.run_and_verify_svn(None, None, [], 'update', '-r', '2', child_path) # Now try a normal update. expected_output = svntest.wc.State(wc_dir, { 'A/B' : Item(status='D '), }) expected_disk = svntest.main.greek_state.copy() expected_disk.remove('A/B', 'A/B/lambda', 'A/B/F', 'A/B/E', 'A/B/E/alpha', 'A/B/E/beta') svntest.actions.run_and_verify_update(wc_dir, expected_output, expected_disk, None)#----------------------------------------------------------------------# Regression test for issue #1793, whereby 'svn up dir' would delete# dir if schedule-add. Yikes.def update_schedule_add_dir(sbox): "update a schedule-add directory" sbox.build() wc_dir = sbox.wc_dir # Delete directory A/D/G in the repository via immediate commit G_path = os.path.join(wc_dir, 'A', 'D', 'G') G_url = svntest.main.current_repo_url + '/A/D/G' svntest.actions.run_and_verify_svn(None, None, [], 'rm', G_url, '-m', 'rev 2') # Update the wc to HEAD (r2)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -