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

📄 update_tests.py

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 PY
📖 第 1 页 / 共 5 页
字号:
  svntest.actions.run_and_verify_update(wc_dir,                                        expected_output,                                        expected_disk,                                        expected_status)#----------------------------------------------------------------------# Issue 847.  Doing an add followed by a remove for an item in state# "deleted" caused the "deleted" state to get forgottendef update_after_add_rm_deleted(sbox):  "update after add/rm of deleted state"  sbox.build()  wc_dir = sbox.wc_dir  # Delete a file and directory from WC  alpha_path = os.path.join(wc_dir, 'A', 'B', 'E', 'alpha')  F_path = os.path.join(wc_dir, 'A', 'B', 'F')  svntest.actions.run_and_verify_svn(None, None, [], 'rm', alpha_path, F_path)  # Commit deletion  expected_output = svntest.wc.State(wc_dir, {    'A/B/E/alpha' : Item(verb='Deleting'),    'A/B/F'       : Item(verb='Deleting'),    })  expected_status = svntest.actions.get_virginal_state(wc_dir, 2)  expected_status.tweak(wc_rev=1)  expected_status.remove('A/B/E/alpha')  expected_status.remove('A/B/F')  svntest.actions.run_and_verify_commit(wc_dir, expected_output,                                        expected_status, None,                                        None, None, None, None, wc_dir)  # alpha and F are now in state "deleted", next we add a new ones  svntest.main.file_append(alpha_path, "new alpha")  svntest.actions.run_and_verify_svn(None, None, [], 'add', alpha_path)  svntest.actions.run_and_verify_svn(None, None, [], 'mkdir', F_path)  # New alpha and F should be in add state A  expected_status.add({    'A/B/E/alpha' : Item(status='A ', wc_rev=0),    'A/B/F'       : Item(status='A ', wc_rev=0),    })  svntest.actions.run_and_verify_status(wc_dir, expected_status)    # Forced removal of new alpha and F must restore "deleted" state    svntest.actions.run_and_verify_svn(None, None, [], 'rm', '--force',                                     alpha_path, F_path)  if os.path.exists(alpha_path) or os.path.exists(F_path):    raise svntest.Failure  # "deleted" state is not visible in status  expected_status.remove('A/B/E/alpha', 'A/B/F')  svntest.actions.run_and_verify_status(wc_dir, expected_status)  # Although parent dir is already at rev 1, the "deleted" state will cause  # alpha and F to be restored in the WC when updated to rev 1  svntest.actions.run_and_verify_svn(None, None, [], 'up', '-r', '1', wc_dir)  expected_status.add({    'A/B/E/alpha' : Item(status='  ', wc_rev=1),    'A/B/F'       : Item(status='  ', wc_rev=1),    })  svntest.actions.run_and_verify_status(wc_dir, expected_status)#----------------------------------------------------------------------# Issue 1591.  Updating a working copy which contains local# obstructions marks a directory as incomplete.  Removal of the# obstruction and subsequent update should clear the "incomplete"# flag.def obstructed_update_alters_wc_props(sbox):  "obstructed update alters WC properties"  sbox.build()  wc_dir = sbox.wc_dir  # Create a new dir in the repo in prep for creating an obstruction.  #print "Adding dir to repo"  svntest.actions.run_and_verify_svn(None, None, [], 'mkdir', '-m',                                     'prep for obstruction',                                     sbox.repo_url + '/A/foo')  # Create an obstruction, a file in the WC with the same name as  # present in a newer rev of the repo.  #print "Creating obstruction"  obstruction_parent_path = os.path.join(wc_dir, 'A')  obstruction_path = os.path.join(obstruction_parent_path, 'foo')  svntest.main.file_append(obstruction_path, 'an obstruction')  # Update the WC to that newer rev to trigger the obstruction.  #print "Updating WC"  expected_output = svntest.wc.State(wc_dir, {})  expected_disk = svntest.main.greek_state.copy()  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)  error_re = 'Failed to add directory.*object of the same name already exists'  svntest.actions.run_and_verify_update(wc_dir,                                        expected_output,                                        expected_disk,                                        expected_status,                                        error_re)  # Remove the file which caused the obstruction.  #print "Removing obstruction"  os.unlink(obstruction_path)  # Update the -- now unobstructed -- WC again.  #print "Updating WC again"  expected_output = svntest.wc.State(wc_dir, {    'A/foo' : Item(status='A '),    })  expected_disk = svntest.main.greek_state.copy()  expected_disk.add({    'A/foo' : Item(),    })  expected_status = svntest.actions.get_virginal_state(wc_dir, 2)  expected_status.add({    'A/foo' : Item(status='  ', wc_rev=2),    })  svntest.actions.run_and_verify_update(wc_dir,                                        expected_output,                                        expected_disk,                                        expected_status)  # The previously obstructed resource should now be in the WC.  if not os.path.isdir(obstruction_path):    raise svntest.Failure#----------------------------------------------------------------------# Issue 938.def update_replace_dir(sbox):  "update that replaces a directory"  sbox.build()  wc_dir = sbox.wc_dir  # Delete a directory  F_path = os.path.join(wc_dir, 'A', 'B', 'F')  svntest.actions.run_and_verify_svn(None, None, [], 'rm', F_path)  # Commit deletion  expected_output = svntest.wc.State(wc_dir, {    'A/B/F'       : Item(verb='Deleting'),    })  expected_status = svntest.actions.get_virginal_state(wc_dir, 2)  expected_status.tweak(wc_rev=1)  expected_status.remove('A/B/F')  svntest.actions.run_and_verify_commit(wc_dir, expected_output,                                        expected_status, None,                                        None, None, None, None, wc_dir)  # Add replacement directory  svntest.actions.run_and_verify_svn(None, None, [], 'mkdir', F_path)  # Commit addition  expected_output = svntest.wc.State(wc_dir, {    'A/B/F'       : Item(verb='Adding'),    })  expected_status = svntest.actions.get_virginal_state(wc_dir, 3)  expected_status.tweak(wc_rev=1)  expected_status.tweak('A/B/F', wc_rev=3)  svntest.actions.run_and_verify_commit(wc_dir, expected_output,                                        expected_status, None,                                        None, None, None, None, wc_dir)  # Update to HEAD  expected_output = svntest.wc.State(wc_dir, {    })  expected_disk = svntest.main.greek_state.copy()  expected_status = svntest.actions.get_virginal_state(wc_dir, 3)  svntest.actions.run_and_verify_update(wc_dir,                                        expected_output,                                        expected_disk,                                        expected_status)  # Update to revision 1 replaces the directory  ### I can't get this to work :-(  #expected_output = svntest.wc.State(wc_dir, {  #  'A/B/F'       : Item(verb='Adding'),  #  'A/B/F'       : Item(verb='Deleting'),  #  })  #expected_status = svntest.actions.get_virginal_state(wc_dir, 1)  #svntest.actions.run_and_verify_update(wc_dir,  #                                      expected_output,  #                                      expected_disk,  #                                      expected_status,  #                                      None, None, None, None, None, 0,  #                                      '-r', '1', wc_dir)  # Update to revision 1 replaces the directory  svntest.actions.run_and_verify_svn(None, None, [], 'up', '-r', '1', wc_dir)  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)  svntest.actions.run_and_verify_status(wc_dir, expected_status)#----------------------------------------------------------------------def update_single_file(sbox):  "update with explicit file target"    sbox.build()  wc_dir = sbox.wc_dir  expected_disk = svntest.main.greek_state.copy()  # Make a local mod to a file which will be committed  mu_path = os.path.join(wc_dir, 'A', 'mu')  svntest.main.file_append (mu_path, '\nAppended text for mu')  # Commit.  expected_output = svntest.wc.State(wc_dir, {    'A/mu' : Item(verb='Sending'),    })  expected_status = svntest.actions.get_virginal_state(wc_dir, 2)  expected_status.tweak(wc_rev=1)  expected_status.tweak('A/mu', wc_rev=2)  svntest.actions.run_and_verify_commit(wc_dir, expected_output,                                        expected_status, None,                                        None, None, None, None, wc_dir)  # At one stage 'svn up file' failed with a parent lock error  was_cwd = os.getcwd()  os.chdir(os.path.join(wc_dir, 'A'))  try:    ### Can't get run_and_verify_update to work having done the chdir.    svntest.actions.run_and_verify_svn("update failed", None, [],                                       'up', '-r', '1', 'mu')  finally:    os.chdir(was_cwd)  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)  svntest.actions.run_and_verify_status(wc_dir, expected_status)#----------------------------------------------------------------------def prop_update_on_scheduled_delete(sbox):  "receive prop update to file scheduled for deletion"    sbox.build()  wc_dir = sbox.wc_dir    other_wc = sbox.add_wc_path('other')  # Make the "other" working copy.  svntest.actions.duplicate_dir(wc_dir, other_wc)  iota_path = os.path.join(wc_dir, 'iota')  other_iota_path = os.path.join(other_wc, 'iota')  svntest.main.run_svn (None, 'propset', 'foo', 'bar', iota_path)  # Created expected output tree for 'svn ci'  expected_output = svntest.wc.State(wc_dir, {    'iota' : Item(verb='Sending'),    })  # Create expected status tree  expected_status = svntest.actions.get_virginal_state(wc_dir, 2)  expected_status.tweak(wc_rev=1)  expected_status.tweak('iota', wc_rev=2)  # Commit the change, creating revision 2.  svntest.actions.run_and_verify_commit(wc_dir, expected_output,                                        expected_status, None,                                        None, None, None, None, wc_dir)  svntest.main.run_svn (None, 'rm', other_iota_path)  # Expected output tree for update of other_wc.  expected_output = svntest.wc.State(other_wc, {    'iota' : Item(status=' U'),    })  # Expected disk tree for the update.  expected_disk = svntest.main.greek_state.copy()  expected_disk.remove('iota')  # Expected status tree for the update.  expected_status = svntest.actions.get_virginal_state(other_wc, 2)  expected_status.tweak('iota', status='D ')    # Do the update and check the results in three ways.  svntest.actions.run_and_verify_update(other_wc,                                        expected_output,                                        expected_disk,                                        expected_status)#----------------------------------------------------------------------def update_receive_illegal_name(sbox):  "bail when receive a file or dir named .svn"  sbox.build()  wc_dir = sbox.wc_dir  # This tests the revision 4334 fix for issue #1068.    legal_url = svntest.main.current_repo_url + '/A/D/G/svn'  illegal_url = (svntest.main.current_repo_url                 + '/A/D/G/' + svntest.main.get_admin_name())  # Ha!  The client doesn't allow us to mkdir a '.svn' but it does  # allow us to copy to a '.svn' so ...  svntest.actions.run_and_verify_svn(None, None, [],                                     'mkdir', '-m', 'log msg',                                     legal_url)  svntest.actions.run_and_verify_svn(None, None, [],                                     'mv', '-m', 'log msg',                                     legal_url, illegal_url)  # Do the update twice, both should fail.  After the first failure  # the wc will be marked "incomplete".  for n in range(2):    out, err = svntest.main.run_svn(1, 'up', wc_dir)    for line in err:      if line.find("object of the same name already exists") != -1:        break    else:      raise svntest.Failure  # At one stage an obstructed update in an incomplete wc would leave  # a txn behind  out, err = svntest.main.run_svnadmin('lstxns', sbox.repo_dir)  if out or err:    raise svntest.Failure#----------------------------------------------------------------------def update_deleted_missing_dir(sbox):  "update missing dir to rev in which it is absent"  sbox.build()  wc_dir = sbox.wc_dir    E_path = os.path.join(wc_dir, 'A', 'B', 'E')  H_path = os.path.join(wc_dir, 'A', 'D', 'H')  # Create a new revision with directories deleted  svntest.main.run_svn(None, 'rm', E_path)    svntest.main.run_svn(None, 'rm', H_path)    svntest.main.run_svn(None, 'ci', '-m', 'log msg', E_path, H_path)    # Update back to the old revision  svntest.main.run_svn(None, 'up', '-r', '1', wc_dir)    # Delete the directories from disk

⌨️ 快捷键说明

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