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

📄 revert_tests.py

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 PY
📖 第 1 页 / 共 2 页
字号:
                                     [], 'revert', file1_path)  # test that file1 really was reverted  expected_status.tweak('file1', status='  ', wc_rev=2)  svntest.actions.run_and_verify_status(wc_dir, expected_status)#----------------------------------------------------------------------# Regression test for issue #876:# svn revert of an svn move'd file does not revert the filedef revert_moved_file(sbox):    "revert a moved file"        sbox.build()    wc_dir = sbox.wc_dir    iota_path = os.path.join(wc_dir, 'iota')    iota_path_moved = os.path.join(wc_dir, 'iota_moved')        svntest.actions.run_and_verify_svn(None, None, [], 'mv', iota_path,                                        iota_path_moved)    expected_output = svntest.actions.get_virginal_state(wc_dir, 1)    expected_output.tweak('iota', status='D ')    expected_output.add({      'iota_moved' : Item(status='A ', copied='+', wc_rev='-'),    })    svntest.actions.run_and_verify_status(wc_dir, expected_output)        # now revert the file iota    svntest.actions.run_and_verify_svn(None,       ["Reverted '" + iota_path + "'\n"], [], 'revert', iota_path)        # at this point, svn status on iota_path_moved should return nothing    # since it should disappear on reverting the move, and since svn status    # on a non-existent file returns nothing.        svntest.actions.run_and_verify_svn(None, [], [],                                       'status', '-v', iota_path_moved)#----------------------------------------------------------------------# Test for issue 2135## It is like merge_file_replace (in merge_tests.py), but reverts file# instead of commit.def revert_file_merge_replace_with_history(sbox):  "revert a merge replacement of file with history"  sbox.build()  wc_dir = sbox.wc_dir  # File scheduled for deletion  rho_path = os.path.join(wc_dir, 'A', 'D', 'G', 'rho')  svntest.actions.run_and_verify_svn(None, None, [], 'rm', rho_path)  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)  expected_status.tweak('A/D/G/rho', status='D ')  svntest.actions.run_and_verify_status(wc_dir, expected_status)  expected_output = svntest.wc.State(wc_dir, {    'A/D/G/rho': Item(verb='Deleting'),    })  expected_status.remove('A/D/G/rho')  # Commit rev 2  svntest.actions.run_and_verify_commit(wc_dir,                                        expected_output,                                        expected_status,                                        None, None, None, None, None,                                        wc_dir)  # create new rho file  fp = open(rho_path, 'w')  fp.write("new rho\n")  fp.close()  # Add the new file  svntest.actions.run_and_verify_svn(None, None, [], 'add', rho_path)  # Commit revsion 3  expected_status.add({    'A/D/G/rho' : Item(status='A ', wc_rev='0')    })  svntest.actions.run_and_verify_status(wc_dir, expected_status)  expected_output = svntest.wc.State(wc_dir, {    'A/D/G/rho': Item(verb='Adding'),    })  svntest.actions.run_and_verify_commit(wc_dir,                                        expected_output,                                        None,                                        None, None, None, None, None,                                        wc_dir)  # Update working copy  expected_output = svntest.wc.State(wc_dir, {})  expected_disk   = svntest.main.greek_state.copy()  expected_disk.tweak('A/D/G/rho', contents='new rho\n' )  expected_status.tweak(wc_rev='3')  expected_status.tweak('A/D/G/rho', status='  ')  svntest.actions.run_and_verify_update(wc_dir,                                        expected_output,                                        expected_disk,                                        expected_status)  # merge changes from r3:1  expected_output = svntest.wc.State(wc_dir, {    'A/D/G/rho': Item(status='A ')    })  expected_status.tweak('A/D/G/rho', status='R ', copied='+', wc_rev='-')  expected_skip = wc.State(wc_dir, { })  expected_disk.tweak('A/D/G/rho', contents="This is the file 'rho'.\n")  svntest.actions.run_and_verify_merge(wc_dir, '3', '1',                                       svntest.main.current_repo_url,                                       expected_output,                                       expected_disk,                                       expected_status,                                       expected_skip)  # Now revert  svntest.actions.run_and_verify_svn(None,                                     None,                                     [], 'revert', rho_path)  # test that rho really was reverted  expected_status.tweak('A/D/G/rho', copied=None, status='  ', wc_rev=3)  svntest.actions.run_and_verify_status(wc_dir, expected_status)  actual_disk = svntest.tree.build_tree_from_wc(wc_dir, 1)  expected_disk.tweak('A/D/G/rho', contents="new rho\n")  svntest.tree.compare_trees(actual_disk, expected_disk.old_tree())def revert_wc_to_wc_replace_with_props(sbox):  "revert svn cp PATH PATH replace file with props"  revert_replacement_with_props(sbox, 1)def revert_repos_to_wc_replace_with_props(sbox):  "revert svn cp URL PATH replace file with props"  revert_replacement_with_props(sbox, 0)def revert_after_second_replace(sbox):  "revert file after second replace"    sbox.build()  wc_dir = sbox.wc_dir  # File scheduled for deletion  rho_path = os.path.join(wc_dir, 'A', 'D', 'G', 'rho')  svntest.actions.run_and_verify_svn(None, None, [], 'rm', rho_path)  # Status before attempting copy  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)  expected_status.tweak('A/D/G/rho', status='D ')  svntest.actions.run_and_verify_status(wc_dir, expected_status)  # Replace file for the first time  pi_src = os.path.join(wc_dir, 'A', 'D', 'G', 'pi')  svntest.actions.run_and_verify_svn("", None, [],                                     'cp', pi_src, rho_path)  expected_status.tweak('A/D/G/rho', status='R ', copied='+', wc_rev='-')  svntest.actions.run_and_verify_status(wc_dir, expected_status)    # Now delete replaced file.  svntest.actions.run_and_verify_svn(None, None, [], 'rm', '--force', rho_path)    # Status should be same as after first delete  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)  expected_status.tweak('A/D/G/rho', status='D ')  svntest.actions.run_and_verify_status(wc_dir, expected_status)  # Replace file for the second time  pi_src = os.path.join(wc_dir, 'A', 'D', 'G', 'pi')  svntest.actions.run_and_verify_svn("", None, [], 'cp', pi_src, rho_path)  expected_status.tweak('A/D/G/rho', status='R ', copied='+', wc_rev='-')  svntest.actions.run_and_verify_status(wc_dir, expected_status)  # Now revert  svntest.actions.run_and_verify_svn("", None, [],                                     'revert', '-R', wc_dir)  # Check disk status  expected_disk = svntest.main.greek_state.copy()  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)  actual_disk = svntest.tree.build_tree_from_wc(wc_dir, 1)  svntest.tree.compare_trees(actual_disk, expected_disk.old_tree())  #----------------------------------------------------------------------# Tests for issue #2517.## Manual conflict resolution leads to spurious revert report.def revert_after_manual_conflict_resolution__text(sbox):  "revert after manual text-conflict resolution"  # Make two working copies  sbox.build()  wc_dir_1 = sbox.wc_dir  wc_dir_2 = sbox.add_wc_path('other')  svntest.actions.duplicate_dir(wc_dir_1, wc_dir_2)  # Cause a (text) conflict  iota_path_1 = os.path.join(wc_dir_1, 'iota')  iota_path_2 = os.path.join(wc_dir_2, 'iota')  svntest.main.file_write(iota_path_1, 'Modified iota text')  svntest.main.file_write(iota_path_2, 'Conflicting iota text')  svntest.main.run_svn(None, 'commit', '-m', 'r2', wc_dir_1)  svntest.main.run_svn(None, 'update', wc_dir_2)  # Resolve the conflict "manually"  svntest.main.file_write(iota_path_2, 'Modified iota text')  os.remove(iota_path_2 + '.mine')  os.remove(iota_path_2 + '.r1')  os.remove(iota_path_2 + '.r2')  # Verify no output from status, diff, or revert  svntest.actions.run_and_verify_svn(None, [], [], "status", wc_dir_2)  svntest.actions.run_and_verify_svn(None, [], [], "diff", wc_dir_2)  svntest.actions.run_and_verify_svn(None, [], [], "revert", "-R", wc_dir_2)def revert_after_manual_conflict_resolution__prop(sbox):  "revert after manual property-conflict resolution"  # Make two working copies  sbox.build()  wc_dir_1 = sbox.wc_dir  wc_dir_2 = sbox.add_wc_path('other')  svntest.actions.duplicate_dir(wc_dir_1, wc_dir_2)  # Cause a (property) conflict  iota_path_1 = os.path.join(wc_dir_1, 'iota')  iota_path_2 = os.path.join(wc_dir_2, 'iota')  svntest.main.run_svn(None, 'propset', 'foo', '1', iota_path_1)  svntest.main.run_svn(None, 'propset', 'foo', '2', iota_path_2)  svntest.main.run_svn(None, 'commit', '-m', 'r2', wc_dir_1)  svntest.main.run_svn(None, 'update', wc_dir_2)  # Resolve the conflict "manually"  svntest.main.run_svn(None, 'propset', 'foo', '1', iota_path_2)  os.remove(iota_path_2 + '.prej')  # Verify no output from status, diff, or revert  svntest.actions.run_and_verify_svn(None, [], [], "status", wc_dir_2)  svntest.actions.run_and_verify_svn(None, [], [], "diff", wc_dir_2)  svntest.actions.run_and_verify_svn(None, [], [], "revert", "-R", wc_dir_2)def revert_propset__dir(sbox):  "revert a simple propset on a dir"  sbox.build()  wc_dir = sbox.wc_dir  a_path = os.path.join(wc_dir, 'A')  svntest.main.run_svn(None, 'propset', 'foo', 'x', a_path)  expected_output = re.escape("Reverted '" + a_path + "'")  svntest.actions.run_and_verify_svn(None, expected_output, [], "revert",                                     a_path)def revert_propset__file(sbox):  "revert a simple propset on a file"  sbox.build()  wc_dir = sbox.wc_dir  iota_path = os.path.join(wc_dir, 'iota')  svntest.main.run_svn(None, 'propset', 'foo', 'x', iota_path)  expected_output = re.escape("Reverted '" + iota_path + "'")  svntest.actions.run_and_verify_svn(None, expected_output, [], "revert",                                     iota_path)def revert_propdel__dir(sbox):  "revert a simple propdel on a dir"  sbox.build()  wc_dir = sbox.wc_dir  a_path = os.path.join(wc_dir, 'A')  svntest.main.run_svn(None, 'propset', 'foo', 'x', a_path)  svntest.main.run_svn(None, 'commit', '-m', 'ps', a_path)  svntest.main.run_svn(None, 'propdel', 'foo', a_path)  expected_output = re.escape("Reverted '" + a_path + "'")  svntest.actions.run_and_verify_svn(None, expected_output, [], "revert",                                     a_path)def revert_propdel__file(sbox):  "revert a simple propdel on a file"  sbox.build()  wc_dir = sbox.wc_dir  iota_path = os.path.join(wc_dir, 'iota')  svntest.main.run_svn(None, 'propset', 'foo', 'x', iota_path)  svntest.main.run_svn(None, 'commit', '-m', 'ps', iota_path)  svntest.main.run_svn(None, 'propdel', 'foo', iota_path)  expected_output = re.escape("Reverted '" + iota_path + "'")  svntest.actions.run_and_verify_svn(None, expected_output, [], "revert",                                     iota_path)######################################################################### Run the tests# list all tests here, starting with None:test_list = [ None,              revert_from_wc_root,              revert_reexpand_keyword,              revert_replaced_file_without_props,              XFail(revert_moved_file),              revert_wc_to_wc_replace_with_props,              revert_file_merge_replace_with_history,              revert_repos_to_wc_replace_with_props,              revert_after_second_replace,              revert_after_manual_conflict_resolution__text,              revert_after_manual_conflict_resolution__prop,              revert_propset__dir,              revert_propset__file,              revert_propdel__dir,              revert_propdel__file,             ]if __name__ == '__main__':  svntest.main.run_tests(test_list)  # NOTREACHED### End of file.

⌨️ 快捷键说明

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