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

📄 copy_tests.py

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 PY
📖 第 1 页 / 共 5 页
字号:
  # Properties are not visible in WC status 'A'  expected_status.add({    'A/D/G/rho' : Item(status=' M', wc_rev='2'),    'A/D/G/rho_wc' : Item(status='A ', wc_rev='-', copied='+'),    'A/D/G/rho_url' : Item(status='A ', wc_rev='-', copied='+'),    })  svntest.actions.run_and_verify_status(wc_dir, expected_status)  # Check properties explicitly  svntest.actions.run_and_verify_svn(None, ['pval\n'], [],                                     'propget', 'pname', rho_wc_path)  svntest.actions.run_and_verify_svn(None, ['pval2\n'], [],                                     'propget', 'pname2', rho_wc_path)  svntest.actions.run_and_verify_svn(None, ['pval\n'], [],                                     'propget', 'pname', rho_url_path)  # Commit and properties are visible in status  expected_output = svntest.wc.State(wc_dir, {    'A/D/G/rho' : Item(verb='Sending'),    'A/D/G/rho_wc' : Item(verb='Adding'),    'A/D/G/rho_url' : Item(verb='Adding'),    })  expected_status.tweak('A/D/G/rho', status='  ', wc_rev=3)  expected_status.remove('A/D/G/rho_wc', 'A/D/G/rho_url')  expected_status.add({    'A/D/G/rho_wc' : Item(status='  ', wc_rev=3),    'A/D/G/rho_url' : Item(status='  ', wc_rev=3),    })  svntest.actions.run_and_verify_commit(wc_dir,                                        expected_output, expected_status,                                        None, None, None, None, None,                                        wc_dir)#----------------------------------------------------------------------# Issue 918def copy_delete_commit(sbox):  "copy a tree and delete part of it before commit"  sbox.build()  wc_dir = sbox.wc_dir  # copy a tree  svntest.actions.run_and_verify_svn(None, None, [], 'cp',                                     wc_dir + '/A/B', wc_dir + '/A/B2')    # delete a file  alpha_path = os.path.join(wc_dir, 'A', 'B2', 'E', 'alpha')  svntest.actions.run_and_verify_svn(None, None, [], 'rm', alpha_path)  # commit copied tree containing a deleted file  expected_output = svntest.wc.State(wc_dir, {    'A/B2' : Item(verb='Adding'),    'A/B2/E/alpha' : Item(verb='Deleting'),    })  svntest.actions.run_and_verify_commit (wc_dir,                                         expected_output,                                         None,                                         None,                                         None, None,                                         None, None,                                         wc_dir)  # copy a tree  svntest.actions.run_and_verify_svn(None, None, [], 'cp',                                     wc_dir + '/A/B', wc_dir + '/A/B3')    # delete a directory  E_path = os.path.join(wc_dir, 'A', 'B3', 'E')  svntest.actions.run_and_verify_svn(None, None, [], 'rm', E_path)  # commit copied tree containing a deleted directory  expected_output = svntest.wc.State(wc_dir, {    'A/B3' : Item(verb='Adding'),    'A/B3/E' : Item(verb='Deleting'),    })  svntest.actions.run_and_verify_commit (wc_dir,                                         expected_output,                                         None,                                         None,                                         None, None,                                         None, None,                                         wc_dir)#----------------------------------------------------------------------def mv_and_revert_directory(sbox):  "move and revert a directory"  sbox.build()  wc_dir = sbox.wc_dir  # Issue 931: move failed to lock the directory being deleted  svntest.actions.run_and_verify_svn(None, None, [], 'move',                                     wc_dir + '/A/B/E',                                     wc_dir + '/A/B/F')  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)  expected_status.tweak('A/B/E', 'A/B/E/alpha', 'A/B/E/beta', status='D ')  expected_status.add({    'A/B/F/E' : Item(status='A ', wc_rev='-', copied='+'),    'A/B/F/E/alpha' : Item(status='  ', wc_rev='-', copied='+'),    'A/B/F/E/beta' : Item(status='  ', wc_rev='-', copied='+'),    })  svntest.actions.run_and_verify_status(wc_dir, expected_status)  # Issue 932: revert failed to lock the parent directory  svntest.actions.run_and_verify_svn(None, None, [], 'revert', '--recursive',                                     wc_dir + '/A/B/F/E')  expected_status.remove('A/B/F/E', 'A/B/F/E/alpha', 'A/B/F/E/beta')  svntest.actions.run_and_verify_status(wc_dir, expected_status)#----------------------------------------------------------------------# Issue 982.  When copying a file with the executable bit set, the copied# file should also have its executable bit set.def copy_preserve_executable_bit(sbox):  "executable bit should be preserved when copying"  # Bootstrap  sbox.build()  wc_dir = sbox.wc_dir  # Create two paths  newpath1 = os.path.join(wc_dir, 'newfile1')  newpath2 = os.path.join(wc_dir, 'newfile2')  # Create the first file.  svntest.main.file_append(newpath1, "a new file")  svntest.actions.run_and_verify_svn(None, None, [], 'add', newpath1)  mode1 = os.stat(newpath1)[stat.ST_MODE]    # Doing this to get the executable bit set on systems that support  # that -- the property itself is not the point.  svntest.actions.run_and_verify_svn(None, None, [], 'propset',                                     'svn:executable', 'on', newpath1)  mode2 = os.stat(newpath1)[stat.ST_MODE]  if mode1 == mode2:    print "setting svn:executable did not change file's permissions"    raise svntest.Failure  # Commit the file  svntest.actions.run_and_verify_svn(None, None, [], 'ci',                                     '-m', 'create file and set svn:executable',                                     wc_dir)  # Copy the file  svntest.actions.run_and_verify_svn(None, None, [], 'cp', newpath1, newpath2)  mode3 = os.stat(newpath2)[stat.ST_MODE]  # The mode on the original and copied file should be identical  if mode2 != mode3:    print "permissions on the copied file are not identical to original file"    raise svntest.Failure#----------------------------------------------------------------------# Issue 1029, copy failed with a "working copy not locked" errordef wc_to_repos(sbox):  "working-copy to repository copy"  sbox.build()  wc_dir = sbox.wc_dir  beta_path = os.path.join(wc_dir, "A", "B", "E", "beta")  beta2_url = svntest.main.current_repo_url + "/A/B/E/beta2"  H_path = os.path.join(wc_dir, "A", "D", "H")  H2_url = svntest.main.current_repo_url + "/A/D/H2"  # modify some items to be copied  svntest.main.file_append(os.path.join(wc_dir, 'A', 'D', 'H', 'omega'),                           "new otext\n")  svntest.actions.run_and_verify_svn(None, None, [], 'propset', 'foo', 'bar',                                     beta_path)  # copy a file  svntest.actions.run_and_verify_svn(None, None, [], '-m', 'fumble file',                                     'copy', beta_path, beta2_url)  # and a directory  svntest.actions.run_and_verify_svn(None, None, [], '-m', 'fumble dir',                                     'copy', H_path, H2_url)  # copy a file to a directory  svntest.actions.run_and_verify_svn(None, None, [], '-m', 'fumble file',                                     'copy', beta_path, H2_url)  expected_output = svntest.wc.State(wc_dir, {    'A/B/E/beta2'  : Item(status='A '),    'A/D/H2'       : Item(status='A '),    'A/D/H2/chi'   : Item(status='A '),    'A/D/H2/omega' : Item(status='A '),    'A/D/H2/psi'   : Item(status='A '),    'A/D/H2/beta'  : Item(status='A '),    })  expected_disk = svntest.main.greek_state.copy()  expected_disk.tweak('A/D/H/omega',                      contents="This is the file 'omega'.\nnew otext\n")  expected_disk.add({    'A/B/E/beta2'  : Item("This is the file 'beta'.\n"),    'A/D/H2/chi'   : Item("This is the file 'chi'.\n"),    'A/D/H2/omega' : Item("This is the file 'omega'.\nnew otext\n"),    'A/D/H2/psi'   : Item("This is the file 'psi'.\n"),    'A/D/H2/beta'  : Item("This is the file 'beta'.\n"),    })  expected_status = svntest.actions.get_virginal_state(wc_dir, 4)  expected_status.add({    'A/B/E/beta'   : Item(status=' M', wc_rev=4),    'A/D/H/omega'  : Item(status='M ', wc_rev=4),    'A/B/E/beta2'  : Item(status='  ', wc_rev=4),    'A/D/H2'       : Item(status='  ', wc_rev=4),    'A/D/H2/chi'   : Item(status='  ', wc_rev=4),    'A/D/H2/omega' : Item(status='  ', wc_rev=4),    'A/D/H2/psi'   : Item(status='  ', wc_rev=4),    'A/D/H2/beta'  : Item(status='  ', wc_rev=4),    })  svntest.actions.run_and_verify_update(wc_dir,                                        expected_output,                                        expected_disk,                                        expected_status)  # check local property was copied  svntest.actions.run_and_verify_svn(None, ['bar\n'], [], 'propget', 'foo',                                     beta_path + "2")#----------------------------------------------------------------------# Issue 1090: various use-cases of 'svn cp URL wc' where the# repositories might be different, or be the same repository.def repos_to_wc(sbox):  "repository to working-copy copy"  sbox.build()  wc_dir = sbox.wc_dir  # We have a standard repository and working copy.  Now we create a  # second repository with the same greek tree, but different UUID.  repo_dir       = sbox.repo_dir  repo_url       = sbox.repo_url  other_repo_dir, other_repo_url = sbox.add_repo_path('other')  svntest.main.copy_repos(repo_dir, other_repo_dir, 1, 1)  # URL->wc copy:  # copy a file and a directory from the same repository.  # we should get some scheduled additions *with history*.  E_url = svntest.main.current_repo_url + "/A/B/E"  pi_url = svntest.main.current_repo_url + "/A/D/G/pi"  pi_path = os.path.join (wc_dir, 'pi')  svntest.actions.run_and_verify_svn(None, None, [], 'copy', E_url, wc_dir)  svntest.actions.run_and_verify_svn(None, None, [], 'copy', pi_url, wc_dir)  # Extra test: modify file ASAP to check there was a timestamp sleep  svntest.main.file_append(pi_path, 'zig\n')  expected_output = svntest.actions.get_virginal_state(wc_dir, 1)  expected_output.add({    'pi' : Item(status='A ', copied='+', wc_rev='-'),    'E' :  Item(status='A ', copied='+', wc_rev='-'),    'E/alpha' :  Item(status='  ', copied='+', wc_rev='-'),    'E/beta'  :  Item(status='  ', copied='+', wc_rev='-'),    })  svntest.actions.run_and_verify_status (wc_dir, expected_output)  # Modification will only show up if timestamps differ  out,err = svntest.main.run_svn(None, 'diff', pi_path)  if err or not out:    print "diff failed"    raise svntest.Failure  for line in out:    if line == '+zig\n': # Crude check for diff-like output      break  else:    print "diff output incorrect", out    raise svntest.Failure    # Revert everything and verify.  svntest.actions.run_and_verify_svn(None, None, [], 'revert', '-R', wc_dir)  svntest.main.safe_rmtree(os.path.join(wc_dir, 'E'))  os.unlink(os.path.join(wc_dir, 'pi'))  expected_output = svntest.actions.get_virginal_state(wc_dir, 1)  svntest.actions.run_and_verify_status (wc_dir, expected_output)  # URL->wc copy:  # Copy an empty directory from the same repository, see issue #1444.  C_url = svntest.main.current_repo_url + "/A/C"  svntest.actions.run_and_verify_svn(None, None, [], 'copy', C_url, wc_dir)  expected_output = svntest.actions.get_virginal_state(wc_dir, 1)  expected_output.add({    'C' :  Item(status='A ', copied='+', wc_rev='-'),    })  svntest.actions.run_and_verify_status (wc_dir, expected_output)    # Revert everything and verify.  svntest.actions.run_and_verify_svn(None, None, [], 'revert', '-R', wc_dir)  svntest.main.safe_rmtree(os.path.join(wc_dir, 'C'))  expected_output = svntest.actions.get_virginal_state(wc_dir, 1)  svntest.actions.run_and_verify_status (wc_dir, expected_output)  # URL->wc copy:  # copy a file and a directory from a foreign repository.  # we should get some scheduled additions *without history*.  E_url = other_repo_url + "/A/B/E"  pi_url = other_repo_url + "/A/D/G/pi"  # Expect an error in the directory case  svntest.actions.run_and_verify_svn("", None, SVNAnyOutput,                                     'copy', E_url, wc_dir)    # But file case should work fine.  svntest.actions.run_and_verify_svn(None, None, [], 'copy', pi_url, wc_dir)  expected_output = svntest.actions.get_virginal_state(wc_dir, 1)  expected_output.add({    'pi' : Item(status='A ',  wc_rev='1'),    })  svntest.actions.run_and_verify_status (wc_dir, expected_output)  # Revert everything and verify.  svntest.actions.run_and_verify_svn(None, None, [], 'revert', '-R', wc_dir)  expected_output = svntest.actions.get_virginal_state(wc_dir, 1)  # URL->wc copy:  # Copy a directory to a pre-existing WC directory.  # The source directory should be copied *under* the target directory.  B_url = svntest.main.current_repo_url + "/A/B"  D_dir = os.path.join (wc_dir, 'A', 'D')  svntest.actions.run_and_verify_svn(None, None, [],                                     'copy', B_url, D_dir)    expected_output = svntest.actions.get_virginal_state(wc_dir, 1)  expected_output.add({    'A/D/B'         : Item(status='A ', copied='+', wc_rev='-'),     'A/D/B/lambda'  : Item(status='  ', copied='+', wc_rev='-'),    'A/D/B/E'       : Item(status='  ', copied='+', wc_rev='-'),    'A/D/B/E/beta'  : Item(status='  ', copied='+', wc_rev='-'),

⌨️ 快捷键说明

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