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

📄 merge_tests.py

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 PY
📖 第 1 页 / 共 5 页
字号:
  svntest.actions.run_and_verify_svn(None, None, [],                                     'cp', B_url, I_url, '-m', 'rev 2')  svntest.actions.run_and_verify_svn(None, None, [],                                     'rm', F_url, '-m', 'rev 3')                                       svntest.actions.run_and_verify_svn(None, None, [],                                     'mkdir', '-m', 'rev 4', J_url)    svntest.actions.run_and_verify_svn(None, None, [],                                      'up', os.path.join(wc_dir,'A'))  expected_output = wc.State(I_path, {})  expected_disk = wc.State('', {    'E'       : Item(),    'E/alpha' : Item("This is the file 'alpha'.\n"),    'E/beta'  : Item("This is the file 'beta'.\n"),    'lambda'  : Item("This is the file 'lambda'.\n"),    })  expected_skip = wc.State(I_path, {    'F/J' : Item(),    'F'   : Item(),    })  svntest.actions.run_and_verify_merge(I_path, '2', '4', B_url,                                       expected_output,                                       expected_disk,                                       None,                                       expected_skip,                                       None, None, None, None, None,                                       0, 0)#----------------------------------------------------------------------# This is a regression for issue #1176.def merge_similar_unrelated_trees(sbox):  "merging similar trees ancestrally unrelated"    ## See http://subversion.tigris.org/issues/show_bug.cgi?id=1249. ##  sbox.build()  wc_dir = sbox.wc_dir  # Simple test.  Make three directories with the same content.  # Modify some stuff in the second one.  Now merge  # (firstdir:seconddir->thirddir).  base1_path = os.path.join(wc_dir, 'base1')  base2_path = os.path.join(wc_dir, 'base2')  apply_path = os.path.join(wc_dir, 'apply')  base1_url = os.path.join(svntest.main.current_repo_url + '/base1')  base2_url = os.path.join(svntest.main.current_repo_url + '/base2')  # Make a tree of stuff ...  os.mkdir(base1_path)  svntest.main.file_append(os.path.join(base1_path, 'iota'),                           "This is the file iota\n")  os.mkdir(os.path.join(base1_path, 'A'))  svntest.main.file_append(os.path.join(base1_path, 'A', 'mu'),                           "This is the file mu\n")  os.mkdir(os.path.join(base1_path, 'A', 'B'))  svntest.main.file_append(os.path.join(base1_path, 'A', 'B', 'alpha'),                           "This is the file alpha\n")  svntest.main.file_append(os.path.join(base1_path, 'A', 'B', 'beta'),                           "This is the file beta\n")  # ... Copy it twice ...  shutil.copytree(base1_path, base2_path)  shutil.copytree(base1_path, apply_path)  # ... Gonna see if merge is naughty or nice!  svntest.main.file_append(os.path.join(base2_path, 'A', 'mu'),                           "A new line in mu.\n")  os.rename(os.path.join(base2_path, 'A', 'B', 'beta'),            os.path.join(base2_path, 'A', 'B', 'zeta'))  svntest.actions.run_and_verify_svn(None, None, [],                                  'add', base1_path, base2_path, apply_path)  svntest.actions.run_and_verify_svn(None, None, [],                                     'ci', '-m', 'rev 2', wc_dir)  expected_output = wc.State(apply_path, {    'A/mu'     : Item(status='U '),    'A/B/zeta' : Item(status='A '),    'A/B/beta' : Item(status='D '),    })  # Search for the comment entitled "The Merge Kluge" elsewhere in  # this file, to understand why we shorten and chdir() below.  saved_cwd = os.getcwd()  try:    os.chdir(svntest.main.work_dir)    # run_and_verify_merge doesn't support 'svn merge URL URL path'    svntest.actions.run_and_verify_svn(None, None, [],                                       'merge',                                       '--ignore-ancestry',                                       base1_url, base2_url,                                       shorten_path_kludge(apply_path))  finally:    os.chdir(saved_cwd)  expected_status = wc.State(apply_path, {    ''            : Item(status='  '),    'A'           : Item(status='  '),    'A/mu'        : Item(status='M '),    'A/B'         : Item(status='  '),    'A/B/zeta'    : Item(status='A ', copied='+'),    'A/B/alpha'   : Item(status='  '),    'A/B/beta'    : Item(status='D '),    'iota'        : Item(status='  '),    })  expected_status.tweak(wc_rev=2)  expected_status.tweak('A/B/zeta', wc_rev='-')  svntest.actions.run_and_verify_status(apply_path, expected_status)#----------------------------------------------------------------------def merge_one_file_helper(sbox, arg_flav):  sbox.build()  wc_dir = sbox.wc_dir    rho_rel_path = os.path.join('A', 'D', 'G', 'rho')  rho_path = os.path.join(wc_dir, rho_rel_path)  G_path = os.path.join(wc_dir, 'A', 'D', 'G')  rho_url = svntest.main.current_repo_url + '/A/D/G/rho'    # Change rho for revision 2  svntest.main.file_append(rho_path, 'A new line in rho.\n')  expected_output = wc.State(wc_dir, { rho_rel_path : Item(verb='Sending'), })  expected_status = svntest.actions.get_virginal_state(wc_dir, 2)  expected_status.tweak(wc_rev=1)  expected_status.tweak('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)    # Backdate rho to revision 1, so we can merge in the rev 2 changes.  svntest.actions.run_and_verify_svn(None, None, [],                                     'up', '-r', '1', rho_path)  # Try one merge with an explicit target; it should succeed.  # ### Yes, it would be nice to use run_and_verify_merge(), but it  # appears to be impossible to get the expected_foo trees working  # right.  I think something is still assuming a directory target.  if arg_flav == 'r':    svntest.actions.run_and_verify_svn(None ,                                       ['U    ' + rho_path + '\n'], [],                                       'merge', '-r', '1:2',                                       rho_url, rho_path)  elif arg_flav == 'c':    svntest.actions.run_and_verify_svn(None ,                                       ['U    ' + rho_path + '\n'], [],                                       'merge', '-c', '2',                                       rho_url, rho_path)  else:    raise svntest.Failure  expected_status.tweak(wc_rev=1)  expected_status.tweak('A/D/G/rho', status='M ')  svntest.actions.run_and_verify_status(wc_dir, expected_status)  # Inspect rho, make sure it's right.  rho_text = svntest.tree.get_text(rho_path)  if rho_text != "This is the file 'rho'.\nA new line in rho.\n":    print "Unexpected text in merged '" + rho_path + "'"    raise svntest.Failure  # Restore rho to pristine revision 1, for another merge.  svntest.actions.run_and_verify_svn(None, None, [], 'revert', rho_path)  expected_status.tweak('A/D/G/rho', status='  ')  svntest.actions.run_and_verify_status(wc_dir, expected_status)  # Cd into the directory and run merge with no targets.  # It should still merge into rho.  saved_cwd = os.getcwd()  try:    os.chdir(G_path)    # Cannot use run_and_verify_merge with a file target    if arg_flav == 'r':      svntest.actions.run_and_verify_svn(None,                                         ['U    rho\n'], [],                                         'merge', '-r', '1:2', rho_url)    elif arg_flav == 'c':      svntest.actions.run_and_verify_svn(None,                                         ['U    rho\n'], [],                                         'merge', '-c', '2', rho_url)    else:      raise svntest.Failure    # Inspect rho, make sure it's right.    rho_text = svntest.tree.get_text('rho')    if rho_text != "This is the file 'rho'.\nA new line in rho.\n":      print "Unexpected text merging to 'rho' in '" + G_path + "'"      raise svntest.Failure  finally:    os.chdir(saved_cwd)  expected_status.tweak('A/D/G/rho', status='M ')  svntest.actions.run_and_verify_status(wc_dir, expected_status)def merge_one_file_using_r(sbox):  "merge one file (issue #1150) using the -r option"  merge_one_file_helper(sbox, 'r')def merge_one_file_using_c(sbox):  "merge one file (issue #1150) using the -c option"  merge_one_file_helper(sbox, 'c')#----------------------------------------------------------------------# This is a regression for the enhancement added in issue #785.def merge_with_implicit_target_helper(sbox, arg_flav):  sbox.build()  wc_dir = sbox.wc_dir    # Change mu for revision 2  mu_path = os.path.join(wc_dir, 'A', 'mu')  orig_mu_text = svntest.tree.get_text(mu_path)  added_mu_text = ""  for x in range(2,11):    added_mu_text = added_mu_text + 'This is line ' + `x` + ' in mu\n'  svntest.main.file_append(mu_path, added_mu_text)  # Create expected output tree for initial commit  expected_output = wc.State(wc_dir, {    'A/mu' : Item(verb='Sending'),    })  # Create expected status tree; all local revisions should be at 1,  # but mu should be at revision 2.  expected_status = svntest.actions.get_virginal_state(wc_dir, 2)  expected_status.tweak(wc_rev=1)  expected_status.tweak('A/mu', wc_rev=2)    # Initial commit.  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)  # Try the merge without an explicit target; it should succeed.  # Can't use run_and_verify_merge cuz it expects a directory argument.  mu_url = svntest.main.current_repo_url + '/A/mu'  was_cwd = os.getcwd()  try:    os.chdir(os.path.join(other_wc, 'A'))    # merge using URL for sourcepath    if arg_flav == 'r':      svntest.actions.run_and_verify_svn(None, ['U    mu\n'], [],                                         'merge', '-r', '2:1', mu_url)    elif arg_flav == 'c':      svntest.actions.run_and_verify_svn(None, ['U    mu\n'], [],                                         'merge', '-c', '-2', mu_url)    else:      raise svntest.Failure    # sanity-check resulting file    if (svntest.tree.get_text('mu') != orig_mu_text):      raise svntest.Failure    # merge using filename for sourcepath    # Cannot use run_and_verify_merge with a file target    if arg_flav == 'r':      svntest.actions.run_and_verify_svn(None, ['G    mu\n'], [],                                         'merge', '-r', '1:2', 'mu')    elif arg_flav == 'c':      svntest.actions.run_and_verify_svn(None, ['G    mu\n'], [],                                         'merge', '-c', '2', 'mu')    else:      raise svntest.Failure    # sanity-check resulting file    if (svntest.tree.get_text('mu') != orig_mu_text + added_mu_text):      raise svntest.Failure  finally:    os.chdir(was_cwd)def merge_with_implicit_target_using_r(sbox):  "merging a file w/no explicit target path using -r"  merge_with_implicit_target_helper(sbox, 'r')def merge_with_implicit_target_using_c(sbox):  "merging a file w/no explicit target path using -c"  merge_with_implicit_target_helper(sbox, 'c')#----------------------------------------------------------------------def merge_with_prev (sbox):  "merge operations using PREV revision"  sbox.build()  wc_dir = sbox.wc_dir    # Change mu for revision 2  mu_path = os.path.join(wc_dir, 'A', 'mu')  orig_mu_text = svntest.tree.get_text(mu_path)  added_mu_text = ""  for x in range(2,11):    added_mu_text = added_mu_text + '\nThis is line ' + `x` + ' in mu'  added_mu_text += "\n"  svntest.main.file_append(mu_path, added_mu_text)  zot_path = os.path.join(wc_dir, 'A', 'zot')    svntest.main.file_append(zot_path, "bar")  svntest.main.run_svn(None, 'add', zot_path)  # Create expected output tree for initial commit  expected_output = wc.State(wc_dir, {    'A/mu' : Item(verb='Sending'),    'A/zot' : Item(verb='Adding'),    })  # Create expected status tree; all local revisions should be at 1,  # but mu should be at revision 2.  expected_status = svntest.actions.get_virginal_state(wc_dir, 2)  expected_status.tweak(wc_rev=1)  expected_status.tweak('A/mu', wc_rev=2)  expected_status.add({'A/zot' : Item(status='  ', wc_rev=2)})    # Initial commit.  svntest.actions.run_and_verify_commit (wc_dir,                                         expected_output,

⌨️ 快捷键说明

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