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

📄 merge_tests.py

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 PY
📖 第 1 页 / 共 5 页
字号:
                                         expected_status,                                         None,                                         None, None, None, None,                                         wc_dir)  # Make some other working copies  other_wc = sbox.add_wc_path('other')  svntest.actions.duplicate_dir(wc_dir, other_wc)    another_wc = sbox.add_wc_path('another')  svntest.actions.duplicate_dir(wc_dir, another_wc)  was_cwd = os.getcwd()  try:    os.chdir(os.path.join(other_wc, 'A'))    # Try to revert the last change to mu via svn merge    # Cannot use run_and_verify_merge with a file target    svntest.actions.run_and_verify_svn(None, ['U    mu\n'], [],                                       'merge', '-r', 'HEAD:PREV', 'mu')    # sanity-check resulting file    if (svntest.tree.get_text('mu') != orig_mu_text):      raise svntest.Failure  finally:    os.chdir(was_cwd)  other_status = expected_status  other_status.wc_dir = other_wc  other_status.tweak('A/mu', status='M ', wc_rev=2)  other_status.tweak('A/zot', wc_rev=2)  svntest.actions.run_and_verify_status(other_wc, other_status)  try:    os.chdir(another_wc)    # ensure 'A' will be at revision 2    svntest.actions.run_and_verify_svn(None, None, [], 'up')    # now try a revert on a directory, and verify that it removed the zot    # file we had added previously    svntest.actions.run_and_verify_svn(None, None, [],                                       'merge', '-r', 'COMMITTED:PREV',                                       'A', 'A')    if (svntest.tree.get_text('A/zot') != None):      raise svntest.Failure      finally:    os.chdir(was_cwd)  another_status = expected_status  another_status.wc_dir = another_wc  another_status.tweak(wc_rev=2)  another_status.tweak('A/mu', status='M ')  another_status.tweak('A/zot', status='D ')  svntest.actions.run_and_verify_status(another_wc, another_status)    #----------------------------------------------------------------------# Regression test for issue #1319: 'svn merge' should *not* 'C' when# merging a change into a binary file, unless it has local mods, or has# different contents from the left side of the merge.def merge_binary_file (sbox):  "merge change into unchanged binary file"  sbox.build()  wc_dir = sbox.wc_dir  # Add a binary file to the project  fp = open(os.path.join(sys.path[0], "theta.bin"))  theta_contents = fp.read()  # suck up contents of a test .png file  fp.close()  theta_path = os.path.join(wc_dir, 'A', 'theta')  fp = open(theta_path, 'w')  fp.write(theta_contents)    # write png filedata into 'A/theta'  fp.close()    svntest.main.run_svn(None, 'add', theta_path)    # Commit the new binary file, creating revision 2.  expected_output = svntest.wc.State(wc_dir, {    'A/theta' : Item(verb='Adding  (bin)'),    })  expected_status = svntest.actions.get_virginal_state(wc_dir, 2)  expected_status.tweak(wc_rev=1)  expected_status.add({    'A/theta' : Item(status='  ', wc_rev=2),    })  svntest.actions.run_and_verify_commit(wc_dir, expected_output,                                        expected_status, None,                                        None, None, None, None, wc_dir)    # Make the "other" working copy  other_wc = sbox.add_wc_path('other')  svntest.actions.duplicate_dir(wc_dir, other_wc)  # Change the binary file in first working copy, commit revision 3.  svntest.main.file_append(theta_path, "some extra junk")  expected_output = wc.State(wc_dir, {    'A/theta' : Item(verb='Sending'),    })  expected_status = svntest.actions.get_virginal_state(wc_dir, 3)  expected_status.tweak(wc_rev=1)  expected_status.add({    'A/theta' : Item(status='  ', wc_rev=3),    })  svntest.actions.run_and_verify_commit(wc_dir, expected_output,                                        expected_status, None,                                        None, None, None, None, wc_dir)  # Search for the comment entitled "The Merge Kluge" elsewhere in  # this file, to understand why we shorten and chdir() below.  short_other_wc = shorten_path_kludge(other_wc)  # In second working copy, attempt to 'svn merge -r 2:3'.  # We should *not* see a conflict during the update, but a 'U'.  # And after the merge, the status should be 'M'.  expected_output = wc.State(short_other_wc, {    'A/theta' : Item(status='U '),    })  expected_disk = svntest.main.greek_state.copy()  expected_disk.add({    'A/theta' : Item(theta_contents + "some extra junk",                     props={'svn:mime-type' : 'application/octet-stream'}),    })  expected_status = svntest.actions.get_virginal_state(short_other_wc, 3)  expected_status.tweak(wc_rev=1)  expected_status.add({    'A/theta' : Item(status='M ', wc_rev=2),    })  expected_skip = wc.State('', { })  saved_cwd = os.getcwd()  try:    os.chdir(svntest.main.work_dir)    svntest.actions.run_and_verify_merge(short_other_wc, '2', '3',                                         svntest.main.current_repo_url,                                         expected_output,                                         expected_disk,                                         expected_status,                                         expected_skip,                                         None, None, None, None, None,                                         1)  finally:    os.chdir(saved_cwd)#----------------------------------------------------------------------# Regression test for issue #2403: Incorrect 3-way merge of "added"# binary file which already exists (unmodified) in the WCdef three_way_merge_add_of_existing_binary_file(sbox):  "3-way merge of 'file add' into existing binary"  sbox.build()  wc_dir = sbox.wc_dir  # Create a branch of A, creating revision 2.  A_url = svntest.main.current_repo_url + "/A"  branch_A_url = svntest.main.current_repo_url + "/copy-of-A"  svntest.actions.run_and_verify_svn(None, None, [], "cp",                                     A_url, branch_A_url,                                     "-m", "Creating copy-of-A")  # Add a binary file to the WC.  fp = open(os.path.join(sys.path[0], "theta.bin"))  theta_contents = fp.read()  # suck up contents of a test .png file  fp.close()  theta_path = os.path.join(wc_dir, "A", "theta")  fp = open(theta_path, "w")  fp.write(theta_contents)    # write png filedata into 'A/theta'  fp.close()    svntest.main.run_svn(None, "add", theta_path)  # Commit the new binary file to the repos, creating revision 3.  expected_output = svntest.wc.State(wc_dir, {    "A/theta" : Item(verb="Adding  (bin)"),    })  expected_status = svntest.actions.get_virginal_state(wc_dir, 3)  expected_status.tweak(wc_rev=1)  # "and nothing else matters..."  expected_status.add({    "A/theta" : Item(status="  ", wc_rev=3),    })  svntest.actions.run_and_verify_commit(wc_dir, expected_output,                                        expected_status, None,                                        None, None, None, None, wc_dir)  # Search for the comment entitled "The Merge Kluge" elsewhere in  # this file, to understand why we shorten and chdir() below.  short_wc = shorten_path_kludge(wc_dir)  # In the working copy, attempt to 'svn merge branch_A_url@2 A_url@3 A'.  # We should *not* see a conflict during the merge, but an 'A'.  # And after the merge, the status should not report any differences.  expected_output = wc.State(short_wc, {    "A/theta" : Item(status="A "),    })  # As greek_state is rooted at / instead of /A (our merge target), we  # need a sub-tree of it rather than straight copy.  expected_disk = svntest.main.greek_state.subtree("A")  expected_disk.add({    "theta" : Item(theta_contents,                   props={"svn:mime-type" : "application/octet-stream"}),    })  expected_status = svntest.actions.get_virginal_state(short_wc, 1)  #expected_status.tweak(wc_rev=1)  expected_status.add({    "A/theta" : Item(status="  ", wc_rev=3),    })  expected_status.remove("")  # top-level of the WC  expected_status.remove("iota")  expected_skip = wc.State("", { })  saved_cwd = os.getcwd()  try:    os.chdir(svntest.main.work_dir)    # If we merge into short_wc alone, theta appears at the WC root,    # which is in the wrong location -- append "/A" to stay on target.    svntest.actions.run_and_verify_merge2(short_wc + "/A", "2", "3",                                          branch_A_url, A_url,                                          expected_output,                                          expected_disk,                                          expected_status,                                          expected_skip,                                          None, None, None, None, None,                                          1)  finally:    os.chdir(saved_cwd)#----------------------------------------------------------------------# Regression test for Issue #1297:# A merge that creates a new file followed by an immediate diff# The diff should succeed.def merge_in_new_file_and_diff(sbox):  "diff after merge that creates a new file"  sbox.build()  wc_dir = sbox.wc_dir    trunk_url = svntest.main.current_repo_url + '/A/B/E'  # Create a branch  svntest.actions.run_and_verify_svn(None, None, [], 'cp',                                      trunk_url,                                     svntest.main.current_repo_url + '/branch',                                     '-m', "Creating the Branch")   # Update to revision 2.  svntest.actions.run_and_verify_svn(None, None, [], 'update', wc_dir)    new_file_path = os.path.join(wc_dir, 'A', 'B', 'E', 'newfile')  fp = open(new_file_path, 'w')  fp.write("newfile\n")  fp.close()  # Add the new file, and commit revision 3.  svntest.actions.run_and_verify_svn(None, None, [], "add", new_file_path)  svntest.actions.run_and_verify_svn(None, None, [], 'ci', '-m',                                     "Changing the trunk.", wc_dir)  # Search for the comment entitled "The Merge Kluge" elsewhere in  # this file, to understand why we shorten and chdir() below.  branch_path = os.path.join(wc_dir, "branch")  short_branch_path = shorten_path_kludge(branch_path)  # Merge our addition into the branch.  expected_output = svntest.wc.State(short_branch_path, {    'newfile' : Item(status='A '),    })  expected_disk = wc.State('', {    'alpha'   : Item("This is the file 'alpha'.\n"),    'beta'    : Item("This is the file 'beta'.\n"),    'newfile' : Item("newfile\n"),    })  expected_status = wc.State(short_branch_path, {    ''        : Item(status='  ', wc_rev=2),    'alpha'   : Item(status='  ', wc_rev=2),    'beta'    : Item(status='  ', wc_rev=2),    'newfile' : Item(status='A ', wc_rev='-', copied='+')    })  expected_skip = wc.State('', { })  saved_cwd = os.getcwd()  try:    os.chdir(svntest.main.work_dir)    svntest.actions.run_and_verify_merge(short_branch_path,                                         '1', 'HEAD', trunk_url,                                         expected_output,                                         expected_disk,                                         expected_status,                                         expected_skip)  finally:    os.chdir(saved_cwd)  # Finally, run diff.  This diff produces no output!  svntest.actions.run_and_verify_svn(None, [], [], 'diff', branch_path)#----------------------------------------------------------------------# Issue #1425:  'svn merge' should skip over any unversioned obstructions.def merge_skips_obstructions(sbox):  "merge should skip over unversioned obstructions"  sbox.build()  wc_dir = sbox.wc_dir  C_path = os.path.join(wc_dir, 'A', 'C')  F_path = os.path.join(wc_dir, 'A', 'B', 'F')  F_url = svntest.main.current_repo_url + '/A/B/F'  Q_path = os.path.join(F_path, 'Q')  foo_path = os.path.join(F_path, 'foo')  bar_path = os.path.join(F_path, 'Q', 'bar')  svntest.main.run_svn(None, 'mkdir', Q_path)  svntest.main.file_append(foo_path, "foo")  svntest.main.file_append(bar_path, "bar")  svntest.main.run_svn(None, 'add', foo_path, bar_path)  expected_output = wc.State(wc_dir, {    'A/B/F/Q'     : Item(verb='Adding'),    'A/B/F/Q/bar' : Item(verb='Adding'),    'A/B/F/foo'   : Item(verb='Adding'),    })  expected_status = svntest.actions.get_virginal_state(wc_dir, 2)  expected_status.tweak(wc_rev=1)  expected_status.add({    'A/B/F/Q'     : Item(statu

⌨️ 快捷键说明

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