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

📄 diff_tests.py

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 PY
📖 第 1 页 / 共 5 页
字号:
  svntest.main.run_svn(None, 'rm', A_path)  expected_output = svntest.wc.State(wc_dir, {    'A' : Item(verb='Deleting'),    })  expected_status = svntest.actions.get_virginal_state(wc_dir, 3)  expected_status.tweak(wc_rev=2)  expected_status.remove('A', 'A/B', 'A/B/E', 'A/B/E/beta', 'A/B/E/alpha',                         'A/B/F', 'A/B/lambda', 'A/D', 'A/D/G', 'A/D/G/rho',                         'A/D/G/pi', 'A/D/G/tau', 'A/D/H', 'A/D/H/psi',                         'A/D/H/omega', 'A/D/H/chi', 'A/D/gamma', 'A/mu',                         'A/C')  svntest.actions.run_and_verify_commit(wc_dir, expected_output,                                        expected_status, None,                                        None, None, None, None, wc_dir)  # Doing an 'svn diff -r1:2' on the URL of directory A should work,  # especially over the DAV layer.  the_url = sbox.repo_url + '/A'  diff_output = svntest.actions.run_and_verify_svn(None, None, [],                                                   'diff', '-r',                                                   '1:2', the_url + "@2")#----------------------------------------------------------------------def diff_targets(sbox):  "select diff targets"  sbox.build()  was_cwd = os.getcwd()  os.chdir(sbox.wc_dir)  try:    update_a_file()    add_a_file()    update_path = os.path.join('A', 'B', 'E', 'alpha')    add_path = os.path.join('A', 'B', 'E', 'theta')    parent_path = os.path.join('A', 'B', 'E')    update_url = svntest.main.current_repo_url + '/A/B/E/alpha'    parent_url = svntest.main.current_repo_url + '/A/B/E'    diff_output, err_output = svntest.main.run_svn(None, 'diff',                                                   update_path, add_path)    if check_update_a_file(diff_output) or check_add_a_file(diff_output):      raise svntest.Failure    diff_output, err_output = svntest.main.run_svn(None, 'diff',                                                   update_path)    if check_update_a_file(diff_output) or not check_add_a_file(diff_output):      raise svntest.Failure    diff_output, err_output = svntest.main.run_svn(None, 'diff',                                                   '--old', parent_path,                                                   'alpha', 'theta')    if check_update_a_file(diff_output) or check_add_a_file(diff_output):      raise svntest.Failure    diff_output, err_output = svntest.main.run_svn(None, 'diff',                                                   '--old', parent_path,                                                   'theta')    if not check_update_a_file(diff_output) or check_add_a_file(diff_output):      raise svntest.Failure    diff_output, err_output = svntest.main.run_svn(None, 'ci', '-m', 'log msg')    diff_output, err_output = svntest.main.run_svn(1, 'diff', '-r1:2',                                                   update_path, add_path)    regex = 'svn: Unable to find repository location for \'.*\''    for line in err_output:      if re.match(regex, line):        break    else:      raise svntest.Failure    diff_output, err_output = svntest.main.run_svn(1, 'diff', '-r1:2',                                                   add_path)    for line in err_output:      if re.match(regex, line):        break    else:      raise svntest.Failure    diff_output, err_output = svntest.main.run_svn(1, 'diff', '-r1:2',                                                   '--old', parent_path,                                                   'alpha', 'theta')    regex = 'svn: \'.*\' was not found in the repository'    for line in err_output:      if re.match(regex, line):        break    else:      raise svntest.Failure    diff_output, err_output = svntest.main.run_svn(None, 'diff', '-r1:2',                                                   '--old', parent_path,                                                   'alpha')    if check_update_a_file(diff_output) or not check_add_a_file(diff_output):      raise svntest.Failure  finally:    os.chdir(was_cwd)  #----------------------------------------------------------------------def diff_branches(sbox):  "diff for branches"  sbox.build()  A_url = svntest.main.current_repo_url + '/A'  A2_url = svntest.main.current_repo_url + '/A2'  svntest.actions.run_and_verify_svn(None, None, [],                                     'cp', '-m', 'log msg',                                     A_url, A2_url)  svntest.actions.run_and_verify_svn(None, None, [],                                     'up', sbox.wc_dir)  A_alpha = os.path.join(sbox.wc_dir, 'A', 'B', 'E', 'alpha')  A2_alpha = os.path.join(sbox.wc_dir, 'A2', 'B', 'E', 'alpha')  svntest.main.file_append(A_alpha, "\nfoo\n")  svntest.actions.run_and_verify_svn(None, None, [],                                     'ci', '-m', 'log msg', sbox.wc_dir)  svntest.main.file_append(A2_alpha, "\nbar\n")  svntest.actions.run_and_verify_svn(None, None, [],                                     'ci', '-m', 'log msg', sbox.wc_dir)  svntest.main.file_append(A_alpha, "zig\n")  # Compare repository file on one branch against repository file on  # another branch  rel_path = os.path.join('B', 'E', 'alpha')  diff_output, err = svntest.actions.run_and_verify_svn(None, None, [],                                                        'diff',                                                        '--old', A_url,                                                        '--new', A2_url,                                                        rel_path)  verify_expected_output(diff_output, "-foo")  verify_expected_output(diff_output, "+bar")  # Same again but using whole branch  diff_output, err = svntest.actions.run_and_verify_svn(None, None, [],                                                        'diff',                                                        '--old', A_url,                                                        '--new', A2_url)  verify_expected_output(diff_output, "-foo")  verify_expected_output(diff_output, "+bar")  # Compare two repository files on different branches  diff_output, err = svntest.actions.run_and_verify_svn(None, None, [],                                                        'diff',                                                        A_url + '/B/E/alpha',                                                        A2_url + '/B/E/alpha')  verify_expected_output(diff_output, "-foo")  verify_expected_output(diff_output, "+bar")  # Compare two versions of a file on a single branch  diff_output, err = svntest.actions.run_and_verify_svn(None, None, [],                                                        'diff',                                                        A_url + '/B/E/alpha@2',                                                        A_url + '/B/E/alpha@3')  verify_expected_output(diff_output, "+foo")  # Compare identical files on different branches  diff_output, err = svntest.actions.run_and_verify_svn(    None, [], [],    'diff', A_url + '/B/E/alpha@2', A2_url + '/B/E/alpha@3')#----------------------------------------------------------------------def diff_repos_and_wc(sbox):  "diff between repos URLs and WC paths"  sbox.build()  A_url = svntest.main.current_repo_url + '/A'  A2_url = svntest.main.current_repo_url + '/A2'  svntest.actions.run_and_verify_svn(None, None, [],                                     'cp', '-m', 'log msg',                                     A_url, A2_url)  svntest.actions.run_and_verify_svn(None, None, [],                                     'up', sbox.wc_dir)  A_alpha = os.path.join(sbox.wc_dir, 'A', 'B', 'E', 'alpha')  A2_alpha = os.path.join(sbox.wc_dir, 'A2', 'B', 'E', 'alpha')  svntest.main.file_append(A_alpha, "\nfoo\n")  svntest.actions.run_and_verify_svn(None, None, [],                                     'ci', '-m', 'log msg', sbox.wc_dir)  svntest.main.file_append(A2_alpha, "\nbar\n")  svntest.actions.run_and_verify_svn(None, None, [],                                     'ci', '-m', 'log msg', sbox.wc_dir)  svntest.main.file_append(A_alpha, "zig\n")  # Compare working file on one branch against repository file on  # another branch  A_path = os.path.join(sbox.wc_dir, 'A')  rel_path = os.path.join('B', 'E', 'alpha')  diff_output, err = svntest.actions.run_and_verify_svn(None, None, [],                                                        'diff',                                                        '--old', A2_url,                                                        '--new', A_path,                                                        rel_path)  verify_expected_output(diff_output, "-bar")  verify_expected_output(diff_output, "+foo")  verify_expected_output(diff_output, "+zig")  # Same again but using whole branch  diff_output, err = svntest.actions.run_and_verify_svn(None, None, [],                                                        'diff',                                                        '--old', A2_url,                                                        '--new', A_path)  verify_expected_output(diff_output, "-bar")  verify_expected_output(diff_output, "+foo")  verify_expected_output(diff_output, "+zig")#----------------------------------------------------------------------def diff_file_urls(sbox):  "diff between two file URLs (issue #1311)"  sbox.build()  iota_path = os.path.join(sbox.wc_dir, 'iota')  iota_url = svntest.main.current_repo_url + '/iota'  iota_copy_path = os.path.join(sbox.wc_dir, 'A', 'iota')  iota_copy_url = svntest.main.current_repo_url + '/A/iota'  iota_copy2_url = svntest.main.current_repo_url + '/A/iota2'  # Put some different text into iota, and commit.  os.remove(iota_path)  svntest.main.file_append(iota_path, "foo\nbar\nsnafu\n")    svntest.actions.run_and_verify_svn(None, None, [],                                     'ci', '-m', 'log msg', iota_path)  # Now, copy the file elsewhere, twice.  svntest.actions.run_and_verify_svn(None, None, [],                                     'cp', '-m', 'log msg',                                     iota_url, iota_copy_url)  svntest.actions.run_and_verify_svn(None, None, [],                                     'cp', '-m', 'log msg',                                     iota_url, iota_copy2_url)  # Update (to get the copies)  svntest.actions.run_and_verify_svn(None, None, [],                                     'up', sbox.wc_dir)  # Now, make edits to one of the copies of iota, and commit.  os.remove(iota_copy_path)  svntest.main.file_append(iota_copy_path, "foo\nsnafu\nabcdefg\nopqrstuv\n")  svntest.actions.run_and_verify_svn(None, None, [],                                     'ci', '-m', 'log msg', iota_copy_path)  # Finally, do a diff between the first and second copies of iota,  # and verify that we got the expected lines.  And then do it in reverse!  out, err = svntest.actions.run_and_verify_svn(None, None, [],                                                'diff',                                                iota_copy_url, iota_copy2_url)  verify_expected_output(out, "+bar")  verify_expected_output(out, "-abcdefg")  verify_expected_output(out, "-opqrstuv")  out, err = svntest.actions.run_and_verify_svn(None, None, [],                                                'diff',                                                iota_copy2_url, iota_copy_url)  verify_expected_output(out, "-bar")  verify_expected_output(out, "+abcdefg")  verify_expected_output(out, "+opqrstuv")  #----------------------------------------------------------------------def diff_prop_change_local_edit(sbox):  "diff a property change plus a local edit"  sbox.build()  iota_path = os.path.join(sbox.wc_dir, 'iota')  iota_url = svntest.main.current_repo_url + '/iota'  # Change a property on iota, and commit.  svntest.actions.run_and_verify_svn(None, None, [],                                     'propset', 'pname', 'pvalue', iota_path)  svntest.actions.run_and_verify_svn(None, None, [],                                     'ci', '-m', 'log msg', iota_path)  # Make local edits to iota.  svntest.main.file_append(iota_path, "\nMore text.\n")  # diff r1:COMMITTED should show the property change but not the local edit.  out, err = svntest.actions.run_and_verify_svn(None, None, [],                                                'diff', '-r1:COMMITTED', iota_path)  for line in out:    if line.find("+More text.") != -1:      raise svntest.Failure  verify_expected_output(out, "   + pvalue")  # diff r1:BASE should show the property change but not the local edit.  out, err = svntest.actions.run_and_verify_svn(None, None, [],                                                'diff', '-r1:BASE', iota_path)  for line in out:    if line.find("+More text.") != -1:      raise svntest.Failure                   # fails at r7481  verify_expected_output(out, "   + pvalue")  # fails at r7481  # diff r1:WC should show the local edit as well as the property change.  out, err = svntest.actions.run_and_verify_svn(None, None, [],                                                'diff', '-r1', iota_path)  verify_expected_output(out, "+More text.")  # fails at r7481  verify_expected_output(out, "   + pvalue")#----------------------------------------------------------------------def check_for_omitted_prefix_in_path_component(sbox):  "check for omitted prefix in path component"  sbox.build()  prefix_path = os.path.join(sbox.wc_dir, 'prefix_mydir')  svntest.actions.run_and_verify_svn(None, None, [],                                     'mkdir', prefix_path)  other_prefix_path = os.path.join(sbox.wc_dir, 'prefix_other')  svntest.actions.run_and_verify_svn(None, None, [],                                     'mkdir', other_prefix_path)  svntest.actions.run_and_verify_svn(None, None, [],                                     'ci', '-m', 'log msg', sbox.wc_dir)  file_path = os.path.join(prefix_path, "test.txt")  f = open(file_path, "w")  f.write("Hello\nThere\nIota\n")  f.close()  svntest.actions.run_and_verify_svn(None, None, [],                                     'add', file_path)  svntest.actions.run_and_verify_svn(None, None, [],                                     'ci', '-m', 'log msg', sbox.wc_dir)  prefix_url = svntest.main.current_repo_url + "/prefix_mydir"  other_prefix_url = svntest.main.current_repo_url + "/prefix_other/mytag"  svntest.actions.run_and_verify_svn(None, None, [],                                     'cp', '-m', 'log msg', prefix_url,                                     other_prefix_url)  f = open(file_path, "w")  f.write("Hello\nWorld\nIota\n")  f.close()  svntest.actions.run_and_verify_svn(None, None, [],                                     'ci', '-m', 'log msg', prefix_path)  out, err = svntest.actions.run_and_verify_svn(None, None, [],                                                'diff', prefix_url,                                                other_prefix_url)  src = extract_diff_path(out[2])  dest = extract_diff_path(out[3])

⌨️ 快捷键说明

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