import sys, re, os, subprocess
import time
import svntest
from svntest import wc, actions, verify
from merge_tests import expected_merge_output
from merge_tests import set_up_branch
Skip = svntest.testcase.Skip_deco
SkipUnless = svntest.testcase.SkipUnless_deco
XFail = svntest.testcase.XFail_deco
Issues = svntest.testcase.Issues_deco
Issue = svntest.testcase.Issue_deco
Wimp = svntest.testcase.Wimp_deco
Item = svntest.wc.StateItem
exp_noop_up_out = svntest.actions.expected_noop_update_output
from svntest.main import SVN_PROP_MERGEINFO, server_has_mergeinfo
def detect_extra_files(node, extra_files):
"""NODE has been discovered as an extra file on disk. Verify that
it matches one of the regular expressions in the EXTRA_FILES list of
lists, and that its contents matches the second part of the list
item. If it matches, remove the match from the list. If it doesn't
match, raise an exception."""
for fdata in extra_files:
wc_dir = fdata[0]
pattern = fdata[1]
contents = None
if len(fdata) > 2:
contents = fdata[2]
match_obj = re.match(pattern, node.name)
if match_obj:
if contents is None:
return
else:
real_path = node.path
if real_path.startswith(svntest.tree.root_node_name):
real_path = real_path[len(svntest.tree.root_node_name) +
len(os.sep) :]
real_path = os.path.join(wc_dir, real_path)
real_contents = open(real_path).read()
if real_contents == contents:
extra_files.pop(extra_files.index(fdata)) return
print("Found unexpected object: %s" % node.name)
raise svntest.tree.SVNTreeUnequal
def update_binary_file(sbox):
"update a locally-modified binary file"
sbox.build()
wc_dir = sbox.wc_dir
theta_contents = open(os.path.join(sys.path[0], "theta.bin"), 'rb').read()
theta_path = os.path.join(wc_dir, 'A', 'theta')
svntest.main.file_write(theta_path, theta_contents, 'wb')
svntest.main.run_svn(None, 'add', theta_path)
expected_output = svntest.wc.State(wc_dir, {
'A/theta' : Item(verb='Adding (bin)'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.add({
'A/theta' : Item(status=' ', wc_rev=2),
})
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
wc_backup = sbox.add_wc_path('backup')
svntest.actions.duplicate_dir(wc_dir, wc_backup)
theta_backup_path = os.path.join(wc_backup, 'A', 'theta')
svntest.main.file_append(theta_path, "revision 3 text")
theta_contents_r3 = theta_contents + "revision 3 text"
expected_output = svntest.wc.State(wc_dir, {
'A/theta' : Item(verb='Sending'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.add({
'A/theta' : Item(status=' ', wc_rev=3),
})
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
svntest.main.file_append(theta_backup_path, "extra theta text")
theta_contents_local = theta_contents + "extra theta text"
expected_output = svntest.wc.State(wc_backup, {
'A/theta' : Item(status='C '),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.add({
'A/theta' : Item(theta_contents_local,
props={'svn:mime-type' : 'application/octet-stream'}),
})
expected_status = svntest.actions.get_virginal_state(wc_backup, 3)
expected_status.add({
'A/theta' : Item(status='C ', wc_rev=3),
})
extra_files = [[wc_backup, 'theta.*\.r2', theta_contents],
[wc_backup, 'theta.*\.r3', theta_contents_r3]]
svntest.actions.run_and_verify_update(wc_backup,
expected_output,
expected_disk,
expected_status,
None,
detect_extra_files, extra_files,
None, None, 1)
if len(extra_files) != 0:
print("Not all extra reject files have been accounted for:")
print(extra_files)
raise svntest.Failure
def update_binary_file_2(sbox):
"update to an old revision of a binary files"
sbox.build()
wc_dir = sbox.wc_dir
theta_contents = open(os.path.join(sys.path[0], "theta.bin"), 'rb').read()
zeta_contents = theta_contents
while(len(zeta_contents) < 102401):
zeta_contents = zeta_contents + zeta_contents
theta_path = os.path.join(wc_dir, 'A', 'theta')
svntest.main.file_write(theta_path, theta_contents, 'wb')
zeta_path = os.path.join(wc_dir, 'A', 'zeta')
svntest.main.file_write(zeta_path, zeta_contents, 'wb')
svntest.main.run_svn(None, 'add', theta_path, zeta_path)
expected_output = svntest.wc.State(wc_dir, {
'A/theta' : Item(verb='Adding (bin)'),
'A/zeta' : Item(verb='Adding (bin)'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.add({
'A/theta' : Item(status=' ', wc_rev=2),
'A/zeta' : Item(status=' ', wc_rev=2),
})
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
svntest.main.file_append(theta_path, "foobar")
new_theta_contents = theta_contents + "foobar"
svntest.main.file_append(zeta_path, "foobar")
new_zeta_contents = zeta_contents + "foobar"
expected_output = svntest.wc.State(wc_dir, {
'A/theta' : Item(verb='Sending'),
'A/zeta' : Item(verb='Sending'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.add({
'A/theta' : Item(status=' ', wc_rev=3),
'A/zeta' : Item(status=' ', wc_rev=3),
})
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
expected_output = svntest.wc.State(wc_dir, {
'A/theta' : Item(status='U '),
'A/zeta' : Item(status='U '),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.add({
'A/theta' : Item(theta_contents,
props={'svn:mime-type' : 'application/octet-stream'}),
'A/zeta' : Item(zeta_contents,
props={'svn:mime-type' : 'application/octet-stream'}),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
expected_status.add({
'A/theta' : Item(status=' ', wc_rev=2),
'A/zeta' : Item(status=' ', wc_rev=2),
})
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status,
None, None, None,
None, None, 1,
'-r', '2', wc_dir)
def update_missing(sbox):
"update missing items (by name) in working copy"
sbox.build()
wc_dir = sbox.wc_dir
mu_path = os.path.join(wc_dir, 'A', 'mu')
rho_path = os.path.join(wc_dir, 'A', 'D', 'G', 'rho')
E_path = os.path.join(wc_dir, 'A', 'B', 'E')
H_path = os.path.join(wc_dir, 'A', 'D', 'H')
os.remove(mu_path)
os.remove(rho_path)
svntest.main.safe_rmtree(E_path)
svntest.main.safe_rmtree(H_path)
if svntest.main.wc_is_singledb(wc_dir):
A_or_Restored = Item(verb='Restored')
else:
A_or_Restored = Item(status='A ')
expected_output = svntest.wc.State(wc_dir, {
'A/mu' : Item(verb='Restored'),
'A/D/G/rho' : Item(verb='Restored'),
'A/B/E' : A_or_Restored,
'A/B/E/alpha' : A_or_Restored,
'A/B/E/beta' : A_or_Restored,
'A/D/H' : A_or_Restored,
'A/D/H/chi' : A_or_Restored,
'A/D/H/omega' : A_or_Restored,
'A/D/H/psi' : A_or_Restored,
})
expected_disk = svntest.main.greek_state.copy()
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,
mu_path, rho_path,
E_path, H_path)
def update_ignores_added(sbox):
"update should not munge adds or replaces"
sbox.build()
wc_dir = sbox.wc_dir
rho_path = os.path.join(wc_dir, 'A', 'D', 'G', 'rho')
svntest.main.file_append(rho_path, "More stuff in rho.\n")
svntest.main.run_svn(None,
'ci', '-m', 'log msg', rho_path)
zeta_path = os.path.join(wc_dir, 'A', 'B', 'zeta')
svntest.main.file_append(zeta_path, "This is the file 'zeta'.\n")
svntest.main.run_svn(None, 'add', zeta_path)
gamma_path = os.path.join(wc_dir, 'A', 'D', 'gamma')
svntest.main.run_svn(None, 'delete', gamma_path)
svntest.main.file_append(gamma_path, "This is a new 'gamma' now.\n")
svntest.main.run_svn(None, 'add', gamma_path)
expected_output = svntest.wc.State(wc_dir, { })
expected_disk = svntest.main.greek_state.copy()
expected_disk.add({
'A/B/zeta' : Item("This is the file 'zeta'.\n"),
})
expected_disk.tweak('A/D/gamma', contents="This is a new 'gamma' now.\n")
expected_disk.tweak('A/D/G/rho',
contents="This is the file 'rho'.\nMore stuff in rho.\n")
expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
expected_status.tweak('A/D/gamma', wc_rev=2, status='R ')
expected_status.add({
'A/B/zeta' : Item(status='A ', wc_rev=0),
})
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status)
def update_to_rev_zero(sbox):
"update to revision 0"
sbox.build()
wc_dir = sbox.wc_dir
iota_path = os.path.join(wc_dir, 'iota')
A_path = os.path.join(wc_dir, 'A')
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(status='D '),
'A' : Item(status='D '),
})
expected_disk = svntest.wc.State(wc_dir, { })
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
None, None,
None, None, None, None, 0,
'-r', '0', wc_dir)
def receive_overlapping_same_change(sbox):
"overlapping identical changes should not conflict"
sbox.build()
wc_dir = sbox.wc_dir
iota_path = os.path.join(wc_dir, 'iota')
svntest.main.file_append(iota_path, "A change to iota.\n")
other_wc = sbox.add_wc_path('other')
svntest.actions.duplicate_dir(wc_dir, other_wc)
other_iota_path = os.path.join(other_wc, 'iota')
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(verb='Sending'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('iota', wc_rev=2)
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
expected_output = svntest.wc.State(other_wc, {
'iota' : Item(status='G '),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.tweak('iota',
contents="This is the file 'iota'.\nA change to iota.\n")
expected_status = svntest.actions.get_virginal_state(other_wc, 2)
svntest.actions.run_and_verify_update(other_wc,
expected_output,
expected_disk,
expected_status)
def update_to_resolve_text_conflicts(sbox):
"delete files and update to resolve text conflicts"
sbox.build()
wc_dir = sbox.wc_dir
wc_backup = sbox.add_wc_path('backup')
svntest.actions.duplicate_dir(wc_dir, wc_backup)
mu_path = os.path.join(wc_dir, 'A', 'mu')
rho_path = os.path.join(wc_dir, 'A', 'D', 'G', 'rho')
svntest.main.file_append(mu_path, 'Original appended text for mu\n')
svntest.main.file_append(rho_path, 'Original appended text for rho\n')
svntest.main.run_svn(None, 'propset', 'Kubla', 'Khan', rho_path)
mu_path_backup = os.path.join(wc_backup, 'A', 'mu')
rho_path_backup = os.path.join(wc_backup, 'A', 'D', 'G', 'rho')
svntest.main.file_append(mu_path_backup,
'Conflicting appended text for mu\n')
svntest.main.file_append(rho_path_backup,
'Conflicting appended text for rho\n')
svntest.main.run_svn(None, 'propset', 'Kubla', 'Xanadu', rho_path_backup)
expected_output = svntest.wc.State(wc_dir, {
'A/mu' : Item(verb='Sending'),
'A/D/G/rho' : Item(verb='Sending'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('A/mu', wc_rev=2)
expected_status.tweak('A/D/G/rho', wc_rev=2, status=' ')
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
expected_output = svntest.wc.State(wc_backup, {
'A/mu' : Item(status='C '),
'A/D/G/rho' : Item(status='CC'),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.tweak('A/mu',
contents="\n".join(["This is the file 'mu'.",
"<<<<<<< .mine",
"Conflicting appended text for mu",
"=======",
"Original appended text for mu",
">>>>>>> .r2",
""]))
expected_disk.tweak('A/D/G/rho',
contents="\n".join(["This is the file 'rho'.",
"<<<<<<< .mine",
"Conflicting appended text for rho",
"=======",
"Original appended text for rho",
">>>>>>> .r2",
""]))
expected_status = svntest.actions.get_virginal_state(wc_backup, 2)
expected_status.tweak('A/mu', status='C ')
expected_status.tweak('A/D/G/rho', status='CC')
extra_files = ['mu.*\.r1', 'mu.*\.r2', 'mu.*\.mine',
'rho.*\.r1', 'rho.*\.r2', 'rho.*\.mine', 'rho.*\.prej']
svntest.actions.run_and_verify_update(wc_backup,
expected_output,
expected_disk,
expected_status,
None,
svntest.tree.detect_conflict_files,
extra_files)
if len(extra_files) != 0:
print("didn't get expected extra files")
raise svntest.Failure
os.remove(mu_path_backup)
os.remove(rho_path_backup)
exit_code, stdout_lines, stdout_lines = svntest.main.run_svn(None, 'up',
wc_backup)
if len (stdout_lines) > 0:
print("update 2 failed")
raise svntest.Failure
expected_status = svntest.actions.get_virginal_state(wc_backup, 2)
expected_status.tweak('A/D/G/rho', status=' C')
svntest.actions.run_and_verify_status(wc_backup, expected_status)
def update_delete_modified_files(sbox):
"update that deletes modified files"
sbox.build()
wc_dir = sbox.wc_dir
alpha_path = os.path.join(wc_dir, 'A', 'B', 'E', 'alpha')
svntest.actions.run_and_verify_svn("Deleting alpha failed", None, [],
'rm', alpha_path)
G_path = os.path.join(wc_dir, 'A', 'D', 'G')
svntest.actions.run_and_verify_svn("Deleting G failed", None, [],
'rm', G_path)
svntest.actions.run_and_verify_svn("Committing deletes failed", None, [],
'ci', '-m', 'log msg', wc_dir)
svntest.actions.run_and_verify_svn("Updating after commit failed", None, [],
'up', wc_dir)
svntest.actions.run_and_verify_svn("Backdating failed", None, [],
'up', '-r', '1', wc_dir)
svntest.main.file_append(alpha_path, 'appended alpha text\n')
pi_path = os.path.join(G_path, 'pi')
svntest.main.file_append(pi_path, 'appended pi text\n')
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('A/B/E/alpha', 'A/D/G/pi', status='M ')
svntest.actions.run_and_verify_status(wc_dir, expected_status)
expected_output = svntest.wc.State(wc_dir, {
'A/B/E/alpha' : Item(status=' ', treeconflict='C'),
'A/D/G' : Item(status=' ', treeconflict='C'),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.tweak('A/B/E/alpha',
contents=\
"This is the file 'alpha'.\nappended alpha text\n")
expected_disk.tweak('A/D/G/pi',
contents=\
"This is the file 'pi'.\nappended pi text\n")
expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
expected_status.tweak('A/B/E/alpha', status='A ', copied='+', wc_rev='-',
treeconflict='C')
expected_status.tweak('A/D/G/pi', status='M ')
expected_status.tweak('A/D/G/pi', status='M ', copied='+', wc_rev='-')
expected_status.tweak('A/D/G/rho', 'A/D/G/tau', status=' ', copied='+',
wc_rev='-')
expected_status.tweak('A/D/G', status='A ', copied='+', wc_rev='-',
treeconflict='C')
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status)
def update_after_add_rm_deleted(sbox):
"update after add/rm of deleted state"
sbox.build()
wc_dir = sbox.wc_dir
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)
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, 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, wc_dir)
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)
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)
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
expected_status.remove('A/B/E/alpha', 'A/B/F')
svntest.actions.run_and_verify_status(wc_dir, expected_status)
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)
def obstructed_update_alters_wc_props(sbox):
"obstructed update alters WC properties"
sbox.build()
wc_dir = sbox.wc_dir
svntest.actions.run_and_verify_svn(None, None, [],
'mkdir', '-m',
'prep for obstruction',
sbox.repo_url + '/A/foo')
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')
expected_output = svntest.wc.State(wc_dir, {
'A/foo' : Item(status=' ', treeconflict='C'),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.add({
'A/foo' : Item(contents="an obstruction"),
})
expected_status = actions.get_virginal_state(wc_dir, 2)
expected_status.add({
'A/foo' : Item(status='D ', treeconflict='C', wc_rev=2),
})
actions.run_and_verify_update(wc_dir, expected_output, expected_disk,
expected_status, None, None, None, None, None, False, wc_dir)
os.unlink(obstruction_path)
svntest.main.run_svn(None, 'revert', obstruction_path)
expected_output = svntest.wc.State(wc_dir, {
})
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)
if not os.path.isdir(obstruction_path):
raise svntest.Failure
def update_replace_dir(sbox):
"update that replaces a directory"
sbox.build()
wc_dir = sbox.wc_dir
F_path = os.path.join(wc_dir, 'A', 'B', 'F')
svntest.actions.run_and_verify_svn(None, None, [], 'rm', F_path)
expected_output = svntest.wc.State(wc_dir, {
'A/B/F' : Item(verb='Deleting'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.remove('A/B/F')
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
svntest.actions.run_and_verify_svn(None, None, [], 'mkdir', F_path)
expected_output = svntest.wc.State(wc_dir, {
'A/B/F' : Item(verb='Adding'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('A/B/F', wc_rev=3)
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
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)
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()
mu_path = os.path.join(wc_dir, 'A', 'mu')
svntest.main.file_append(mu_path, '\nAppended text for mu')
expected_output = svntest.wc.State(wc_dir, {
'A/mu' : Item(verb='Sending'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('A/mu', wc_rev=2)
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
was_cwd = os.getcwd()
os.chdir(os.path.join(wc_dir, 'A'))
svntest.actions.run_and_verify_svn("update failed", None, [],
'up', '-r', '1', 'mu')
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')
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)
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(verb='Sending'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('iota', wc_rev=2)
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
svntest.main.run_svn(None, 'rm', other_iota_path)
expected_output = svntest.wc.State(other_wc, {
'iota' : Item(status=' ', treeconflict='C'),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.remove('iota')
expected_status = svntest.actions.get_virginal_state(other_wc, 2)
expected_status.tweak('iota', status='D ', treeconflict='C')
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
legal_url = sbox.repo_url + '/A/D/G/svn'
illegal_url = (sbox.repo_url
+ '/A/D/G/' + svntest.main.get_admin_name())
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)
for n in range(2):
exit_code, out, err = svntest.main.run_svn(1, 'up', wc_dir)
for line in err:
if line.find("of the same name") != -1:
break
else:
raise svntest.Failure
exit_code, 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')
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)
svntest.main.run_svn(None,
'up', '-r', '1', wc_dir)
svntest.main.safe_rmtree(E_path)
svntest.main.safe_rmtree(H_path)
expected_output = svntest.wc.State(wc_dir, {
'A/B/E' : Item(status='D '),
'A/D/H' : Item(status='D '),
})
if svntest.main.wc_is_singledb(wc_dir):
expected_output.add({
'A/D/H/psi' : Item(verb='Restored'),
'A/D/H/omega' : Item(verb='Restored'),
'A/D/H/chi' : Item(verb='Restored'),
'A/B/E/beta' : Item(verb='Restored'),
'A/B/E/alpha' : Item(verb='Restored')
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.remove('A/B/E', 'A/B/E/alpha', 'A/B/E/beta')
expected_disk.remove('A/D/H', 'A/D/H/chi', 'A/D/H/omega', 'A/D/H/psi')
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.remove('A/B/E', 'A/B/E/alpha', 'A/B/E/beta')
expected_status.remove('A/D/H', 'A/D/H/chi', 'A/D/H/omega', 'A/D/H/psi')
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status,
None, None, None, None, None,
0, "-r", "2", E_path, H_path)
svntest.main.run_svn(None,
'up', '-r', '1', wc_dir)
expected_status.tweak(wc_rev=2)
expected_output = svntest.wc.State(wc_dir, {
'A/B/E' : Item(status='D '),
'A/D/H' : Item(status='D '),
})
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status,
None, None, None, None, None,
0, "-r", "2", wc_dir)
def another_hudson_problem(sbox):
"another \"hudson\" problem: updates that delete"
sbox.build()
wc_dir = sbox.wc_dir
gamma_path = os.path.join(wc_dir, 'A', 'D', 'gamma')
svntest.main.run_svn(None, 'rm', gamma_path)
expected_output = svntest.wc.State(wc_dir, {
'A/D/gamma' : Item(verb='Deleting'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.remove('A/D/gamma')
svntest.actions.run_and_verify_commit(wc_dir,
expected_output,
expected_status,
None, wc_dir)
svntest.actions.run_and_verify_svn(None,
['\n', 'Committed revision 3.\n'], [],
'rm', '-m', 'log msg',
sbox.repo_url + '/A/D/G')
G_path = os.path.join(wc_dir, 'A', 'D', 'G')
svntest.main.safe_rmtree(G_path)
if not svntest.main.wc_is_singledb(wc_dir):
expected_output = ["Updating '%s' ...\n" % (G_path),
'D '+G_path+'\n',
'Updated to revision 3.\n',
]
else:
expected_output = ["Updating '%s':\n" % (G_path),
'Restored \'' + G_path + '\'\n',
'Restored \'' + G_path + os.path.sep + 'pi\'\n',
'Restored \'' + G_path + os.path.sep + 'rho\'\n',
'Restored \'' + G_path + os.path.sep + 'tau\'\n',
'D '+G_path+'\n',
'Updated to revision 3.\n',
]
expected_output = svntest.verify.UnorderedOutput(expected_output)
svntest.actions.run_and_verify_svn(None,
expected_output, [],
'up', G_path)
expected_status = svntest.actions.get_virginal_state(wc_dir, 3)
expected_status.remove('A/D/G', 'A/D/G/pi', 'A/D/G/rho', 'A/D/G/tau',
'A/D/gamma')
expected_disk = svntest.main.greek_state.copy()
expected_disk.remove('A/D/G', 'A/D/G/pi', 'A/D/G/rho', 'A/D/G/tau',
'A/D/gamma')
svntest.actions.run_and_verify_update(wc_dir,
"",
expected_disk,
expected_status)
def update_deleted_targets(sbox):
"explicit update of deleted=true targets"
sbox.build()
wc_dir = sbox.wc_dir
gamma_path = os.path.join(wc_dir, 'A', 'D', 'gamma')
F_path = os.path.join(wc_dir, 'A', 'B', 'F')
svntest.main.run_svn(None, 'rm', gamma_path, F_path)
expected_output = svntest.wc.State(wc_dir, {
'A/D/gamma' : Item(verb='Deleting'),
'A/B/F' : Item(verb='Deleting'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.remove('A/D/gamma', 'A/B/F')
svntest.actions.run_and_verify_commit(wc_dir,
expected_output,
expected_status,
None, wc_dir)
svntest.actions.run_and_verify_svn(None, exp_noop_up_out(2), [],
'update', gamma_path)
svntest.actions.run_and_verify_svn(None, exp_noop_up_out(2), [],
'update', F_path)
expected_output = svntest.wc.State(wc_dir, {
'A/D/gamma' : Item(status='A '),
'A/B/F' : Item(status='A '),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_disk = svntest.main.greek_state.copy()
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status,
None, None, None, None, None, 0,
'-r', '1', wc_dir)
def new_dir_with_spaces(sbox):
"receive new dir with spaces in its name"
sbox.build()
wc_dir = sbox.wc_dir
svntest.actions.run_and_verify_svn(None,
['\n', 'Committed revision 2.\n'], [],
'mkdir', '-m', 'log msg',
sbox.repo_url
+ '/A/spacey%20dir')
expected_output = svntest.wc.State(wc_dir, {
'A/spacey dir' : Item(status='A '),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
expected_status.add({
'A/spacey dir' : Item(status=' ', wc_rev=2),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.add({
'A/spacey dir' : Item(),
})
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status)
def non_recursive_update(sbox):
"non-recursive update"
sbox.build()
wc_dir = sbox.wc_dir
mu_path = os.path.join(wc_dir, 'A', 'mu')
rho_path = os.path.join(wc_dir, 'A', 'D', 'G', 'rho')
svntest.main.file_append(mu_path, "new")
svntest.main.file_append(rho_path, "new")
expected_output = svntest.wc.State(wc_dir, {
'A/mu' : Item(verb='Sending'),
'A/D/G/rho' : Item(verb='Sending'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('A/mu', 'A/D/G/rho', wc_rev=2)
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status,
None, wc_dir)
expected_output = svntest.wc.State(wc_dir, {
'A/mu' : Item(status='U '),
'A/D/G/rho' : Item(status='U '),
})
expected_disk = svntest.main.greek_state.copy()
expected_status.tweak('A/mu', 'A/D/G/rho', wc_rev=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)
A_path = os.path.join(wc_dir, 'A')
expected_output = svntest.wc.State(wc_dir, {
'A/mu' : Item(status='U '),
})
expected_status.tweak('A', 'A/mu', wc_rev=2)
expected_disk.tweak('A/mu', contents="This is the file 'mu'.\nnew")
svntest.actions.run_and_verify_update(wc_dir, expected_output,
expected_disk, expected_status,
None, None, None, None, None, 0,
'-N', A_path)
def checkout_empty_dir(sbox):
"check out an empty dir"
sbox.build(create_wc = False)
wc_dir = sbox.wc_dir
C_url = sbox.repo_url + '/A/C'
svntest.main.safe_rmtree(wc_dir)
svntest.actions.run_and_verify_svn(None, None, [], 'checkout', C_url, wc_dir)
svntest.actions.run_and_verify_svn(None, [], [], 'status', wc_dir)
def update_to_deletion(sbox):
"update target till it's gone, then get it back"
sbox.build()
wc_dir = sbox.wc_dir
iota_path = os.path.join(wc_dir, 'iota')
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(status='D '),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.remove('iota')
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
None, None,
None, None, None, None, 0,
'-r', '0', iota_path)
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(status='A '),
})
expected_disk = svntest.main.greek_state.copy()
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
None, None,
None, None, None, None, 0,
wc_dir)
def update_deletion_inside_out(sbox):
"update child before parent of a deleted tree"
sbox.build()
wc_dir = sbox.wc_dir
parent_path = os.path.join(wc_dir, 'A', 'B')
child_path = os.path.join(parent_path, 'E')
svntest.actions.run_and_verify_svn(None, None, [],
'rm', parent_path)
svntest.actions.run_and_verify_svn(None, None, [],
'ci', '-m', '', wc_dir)
svntest.actions.run_and_verify_svn(None, None, [],
'update', '-r', '1', wc_dir)
svntest.actions.run_and_verify_svn(None, None, [],
'update', '-r', '2', child_path)
expected_output = svntest.wc.State(wc_dir, {
'A/B' : Item(status='D '),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.remove('A/B', 'A/B/lambda', 'A/B/F',
'A/B/E', 'A/B/E/alpha', 'A/B/E/beta')
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
None)
def update_schedule_add_dir(sbox):
"update a schedule-add directory"
sbox.build()
wc_dir = sbox.wc_dir
G_path = os.path.join(wc_dir, 'A', 'D', 'G')
G_url = sbox.repo_url + '/A/D/G'
svntest.actions.run_and_verify_svn(None, None, [],
'rm', G_url, '-m', 'rev 2')
expected_output = svntest.wc.State(wc_dir, {
'A/D/G' : Item(status='D '),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.remove('A/D/G', 'A/D/G/pi', 'A/D/G/rho', 'A/D/G/tau')
expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
expected_status.remove('A/D/G', 'A/D/G/pi', 'A/D/G/rho', 'A/D/G/tau')
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status)
D_path = os.path.join(wc_dir, 'A', 'D')
svntest.actions.run_and_verify_svn("Copy error:", None, [],
'cp', G_url + '@1', D_path)
expected_status.add({
'A/D/G' : Item(status='A ', copied='+', wc_rev='-'),
'A/D/G/pi' : Item(status=' ', copied='+', wc_rev='-'),
'A/D/G/rho' : Item(status=' ', copied='+', wc_rev='-'),
'A/D/G/tau' : Item(status=' ', copied='+', wc_rev='-'),
})
svntest.actions.run_and_verify_status(wc_dir, expected_status)
svntest.actions.run_and_verify_svn(None, None, [], 'up', G_path)
svntest.actions.run_and_verify_status(wc_dir, expected_status)
def update_to_future_add(sbox):
"update target that was added in a future rev"
sbox.build()
wc_dir = sbox.wc_dir
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(status='D '),
'A' : Item(status='D '),
})
expected_disk = svntest.wc.State(wc_dir, { })
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
None, None,
None, None, None, None, 0,
'-r', '0', wc_dir)
iota_path = os.path.join(wc_dir, 'iota')
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(status='A '),
})
expected_disk = svntest.wc.State('', {
'iota' : Item("This is the file 'iota'.\n")
})
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
None, None,
None, None, None, None, 0,
iota_path)
A_path = os.path.join(wc_dir, 'A')
expected_output = svntest.wc.State(wc_dir, {
'A' : Item(status='A '),
'A/mu' : Item(status='A '),
'A/B' : Item(status='A '),
'A/B/lambda' : Item(status='A '),
'A/B/E' : Item(status='A '),
'A/B/E/alpha' : Item(status='A '),
'A/B/E/beta' : Item(status='A '),
'A/B/F' : Item(status='A '),
'A/C' : Item(status='A '),
'A/D' : Item(status='A '),
'A/D/gamma' : Item(status='A '),
'A/D/G' : Item(status='A '),
'A/D/G/pi' : Item(status='A '),
'A/D/G/rho' : Item(status='A '),
'A/D/G/tau' : Item(status='A '),
'A/D/H' : Item(status='A '),
'A/D/H/chi' : Item(status='A '),
'A/D/H/psi' : Item(status='A '),
'A/D/H/omega' : Item(status='A ')
})
expected_disk = svntest.main.greek_state.copy()
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
None, None,
None, None, None, None, 0,
A_path);
def nested_in_read_only(sbox):
"update a nested wc in a read-only wc"
sbox.build()
wc_dir = sbox.wc_dir
if svntest.main.wc_is_singledb(wc_dir):
raise svntest.Skip('Unsupported in single-db')
alpha_path = os.path.join(wc_dir, 'A', 'B', 'E', 'alpha')
svntest.actions.run_and_verify_svn(None, None, [], 'rm', alpha_path)
expected_output = svntest.wc.State(wc_dir, {
'A/B/E/alpha' : Item(verb='Deleting'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.remove('A/B/E/alpha')
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
svntest.actions.run_and_verify_svn(None, None, [], 'up', wc_dir)
expected_status.tweak(wc_rev=2)
svntest.actions.run_and_verify_status(wc_dir, expected_status)
B_path = os.path.join(wc_dir, 'A', 'B')
svntest.actions.run_and_verify_svn(None, None, [], 'rm', B_path)
expected_output = svntest.wc.State(wc_dir, {
'A/B' : Item(verb='Deleting'),
})
expected_status.remove('A/B', 'A/B/lambda', 'A/B/E', 'A/B/E/beta', 'A/B/F')
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
svntest.actions.run_and_verify_svn(None, None, [], 'up', wc_dir)
expected_status.tweak(wc_rev=3)
svntest.actions.run_and_verify_status(wc_dir, expected_status)
B_url = sbox.repo_url + '/A/B'
svntest.actions.run_and_verify_svn(None, None, [],
'checkout', '-r', '1', B_url + "@1",
B_path)
expected_status = svntest.wc.State(B_path, {
'' : Item(),
'lambda' : Item(),
'E' : Item(),
'E/alpha' : Item(),
'E/beta' : Item(),
'F' : Item(),
})
expected_status.tweak(wc_rev=1, status=' ')
svntest.actions.run_and_verify_status(B_path, expected_status)
os.chmod(os.path.join(wc_dir, 'A', svntest.main.get_admin_name()), 0555)
try:
expected_output = svntest.wc.State(B_path, {
'E/alpha' : Item(status='D '),
})
expected_disk = wc.State('', {
'lambda' : wc.StateItem("This is the file 'lambda'.\n"),
'E' : wc.StateItem(),
'E/beta' : wc.StateItem("This is the file 'beta'.\n"),
'F' : wc.StateItem(),
})
expected_status.remove('E/alpha')
expected_status.tweak(wc_rev=2)
svntest.actions.run_and_verify_update(B_path,
expected_output,
expected_disk,
expected_status,
None, None, None, None, None, 0,
'-r', '2', B_path)
finally:
os.chmod(os.path.join(wc_dir, 'A', svntest.main.get_admin_name()), 0777)
def update_xml_unsafe_dir(sbox):
"update dir with xml-unsafe name"
sbox.build()
wc_dir = sbox.wc_dir
wc_backup = sbox.add_wc_path('backup')
svntest.actions.duplicate_dir(wc_dir, wc_backup)
test_path = os.path.join(wc_dir, ' foo & bar')
svntest.main.run_svn(None, 'mkdir', test_path)
expected_output = wc.State(wc_dir, {
' foo & bar' : Item(verb='Adding'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.add({
' foo & bar' : Item(status=' ', wc_rev=2),
})
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
os.chdir(test_path)
expected_output = wc.State('', {
})
expected_disk = wc.State('', {
})
expected_status = wc.State('', {
'' : Item(status=' ', wc_rev=2),
})
svntest.actions.run_and_verify_update('', expected_output, expected_disk,
expected_status)
def conflict_markers_matching_eol(sbox):
"conflict markers should match the file's eol style"
sbox.build()
wc_dir = sbox.wc_dir
filecount = 1
mu_path = os.path.join(wc_dir, 'A', 'mu')
if os.name == 'nt':
crlf = '\n'
else:
crlf = '\r\n'
wc_backup = sbox.add_wc_path('backup')
svntest.actions.run_and_verify_svn(None, None, [], 'checkout',
sbox.repo_url, wc_backup)
cur_rev = 1
expected_disk = svntest.main.greek_state.copy()
expected_status = svntest.actions.get_virginal_state(wc_dir, cur_rev)
expected_backup_status = svntest.actions.get_virginal_state(wc_backup,
cur_rev)
path_backup = os.path.join(wc_backup, 'A', 'mu')
for eol, eolchar in zip(['CRLF', 'CR', 'native', 'LF'],
[crlf, '\015', '\n', '\012']):
svntest.main.file_write(mu_path, "This is the file 'mu'."+ eolchar, 'wb')
svntest.main.run_svn(None, 'propset', 'svn:eol-style', eol, mu_path)
expected_disk.add({
'A/mu' : Item("This is the file 'mu'." + eolchar)
})
expected_output = svntest.wc.State(wc_dir, {
'A/mu' : Item(verb='Sending'),
})
expected_status.tweak(wc_rev = cur_rev)
expected_status.add({
'A/mu' : Item(status=' ', wc_rev = cur_rev + 1),
})
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
cur_rev = cur_rev + 1
base_rev = cur_rev
svntest.main.run_svn(None, 'update', wc_backup)
svntest.main.file_append(mu_path,
'Original appended text for mu' + eolchar)
svntest.main.run_svn(None, 'commit', '-m', 'test log', wc_dir)
cur_rev = cur_rev + 1
theirs_rev = cur_rev
svntest.main.file_append(path_backup,
'Conflicting appended text for mu' + eolchar)
expected_backup_output = svntest.wc.State(wc_backup, {
'A/mu' : Item(status='C '),
})
expected_backup_disk = expected_disk.copy()
expected_backup_disk.add({
'A/mu' : Item(contents= "This is the file 'mu'." + eolchar +
"<<<<<<< .mine" + eolchar +
"Conflicting appended text for mu" + eolchar +
"=======" + eolchar +
"Original appended text for mu" + eolchar +
">>>>>>> .r" + str(cur_rev) + eolchar),
})
expected_backup_disk.add({
'A/mu.r' + str(base_rev ) : Item(contents= "This is the file 'mu'." +
eolchar)
})
expected_backup_disk.add({
'A/mu.r' + str(theirs_rev ) : Item(contents= "This is the file 'mu'." +
eolchar +
"Original appended text for mu" + eolchar)
})
expected_backup_disk.add({
'A/mu.mine' : Item(contents= "This is the file 'mu'." +
eolchar +
"Conflicting appended text for mu" + eolchar)
})
expected_backup_status.add({
'A/mu' : Item(status=' ', wc_rev=cur_rev),
})
expected_backup_status.tweak('A/mu', status='C ')
expected_backup_status.tweak(wc_rev = cur_rev)
svntest.actions.run_and_verify_update(wc_backup,
expected_backup_output,
expected_backup_disk,
expected_backup_status,
None,
None,
None)
svntest.main.run_svn(None, 'revert', '-R', wc_backup)
svntest.main.run_svn(None, 'update', wc_dir)
def update_eolstyle_handling(sbox):
"handle eol-style propchange during update"
sbox.build()
wc_dir = sbox.wc_dir
mu_path = os.path.join(wc_dir, 'A', 'mu')
if os.name == 'nt':
crlf = '\n'
else:
crlf = '\r\n'
wc_backup = sbox.add_wc_path('backup')
svntest.actions.run_and_verify_svn(None, None, [], 'checkout',
sbox.repo_url, wc_backup)
path_backup = os.path.join(wc_backup, 'A', 'mu')
svntest.main.run_svn(None, 'propset', 'svn:eol-style', "CRLF", mu_path)
svntest.main.run_svn(None,
'commit', '-m', 'set eol-style property', wc_dir)
svntest.main.file_append_binary(path_backup, 'Added new line of text.\012')
expected_backup_disk = svntest.main.greek_state.copy()
expected_backup_disk.tweak(
'A/mu', contents= "This is the file 'mu'." + crlf +
"Added new line of text." + crlf)
expected_backup_output = svntest.wc.State(wc_backup, {
'A/mu' : Item(status='GU'),
})
expected_backup_status = svntest.actions.get_virginal_state(wc_backup, 2)
expected_backup_status.tweak('A/mu', status='M ')
svntest.actions.run_and_verify_update(wc_backup,
expected_backup_output,
expected_backup_disk,
expected_backup_status,
None, None, None)
svntest.main.run_svn(None, 'propset', 'svn:eol-style', "CR", mu_path)
svntest.main.run_svn(None,
'commit', '-m', 'set eol-style property', wc_dir)
expected_backup_disk = svntest.main.greek_state.copy()
expected_backup_disk.add({
'A/mu' : Item(contents= "This is the file 'mu'.\015" +
"Added new line of text.\015")
})
expected_backup_output = svntest.wc.State(wc_backup, {
'A/mu' : Item(status='GU'),
})
expected_backup_status = svntest.actions.get_virginal_state(wc_backup, 3)
expected_backup_status.tweak('A/mu', status='M ')
svntest.actions.run_and_verify_update(wc_backup,
expected_backup_output,
expected_backup_disk,
expected_backup_status,
None, None, None)
svntest.main.run_svn(None, 'propdel', 'svn:eol-style', mu_path)
svntest.main.run_svn(None,
'commit', '-m', 'del eol-style property', wc_dir)
expected_backup_disk = svntest.main.greek_state.copy()
expected_backup_disk.add({
'A/mu' : Item(contents= "This is the file 'mu'.\015" +
"Added new line of text.\015")
})
expected_backup_output = svntest.wc.State(wc_backup, {
'A/mu' : Item(status=' U'),
})
expected_backup_status = svntest.actions.get_virginal_state(wc_backup, 4)
expected_backup_status.tweak('A/mu', status='M ')
svntest.actions.run_and_verify_update(wc_backup,
expected_backup_output,
expected_backup_disk,
expected_backup_status,
None, None, None)
def update_copy_of_old_rev(sbox):
"update schedule-add copy of old rev"
sbox.build()
wc_dir = sbox.wc_dir
dir = os.path.join(wc_dir, 'A')
dir2 = os.path.join(wc_dir, 'A2')
file = os.path.join(dir, 'mu')
file2 = os.path.join(dir2, 'mu')
url = sbox.repo_url + '/A/mu'
url2 = sbox.repo_url + '/A2/mu'
exit_code, text_r1, err = svntest.actions.run_and_verify_svn(None, None, [],
'cat', '-r1',
url)
svntest.main.file_write(file, "Second revision of 'mu'\n")
svntest.actions.run_and_verify_svn(None, None, [],
'ci', '-m', '', wc_dir)
svntest.actions.run_and_verify_svn(None, None, [],
'cp', '-r1', dir, dir2)
svntest.actions.run_and_verify_svn(None, None, [],
'up', wc_dir)
exp_out = ['Adding ' + dir2 + '\n',
'\n',
'Committed revision 3.\n']
svntest.actions.run_and_verify_svn(None, exp_out, [],
'ci', '-m', '', wc_dir)
svntest.actions.run_and_verify_svn(None, text_r1, [],
'cat', url2)
def forced_update(sbox):
"forced update tolerates obstructions to adds"
sbox.build()
wc_dir = sbox.wc_dir
wc_backup = sbox.add_wc_path('backup')
svntest.actions.duplicate_dir(wc_dir, wc_backup)
mu_path = os.path.join(wc_dir, 'A', 'mu')
rho_path = os.path.join(wc_dir, 'A', 'D', 'G', 'rho')
svntest.main.file_append(mu_path, 'appended mu text')
svntest.main.file_append(rho_path, 'new appended text for rho')
nu_path = os.path.join(wc_dir, 'A', 'B', 'F', 'nu')
svntest.main.file_append(nu_path, "This is the file 'nu'\n")
svntest.main.run_svn(None, 'add', nu_path)
kappa_path = os.path.join(wc_dir, 'kappa')
svntest.main.file_append(kappa_path, "This is the file 'kappa'\n")
svntest.main.run_svn(None, 'add', kappa_path)
I_path = os.path.join(wc_dir, 'A', 'C', 'I')
os.mkdir(I_path)
svntest.main.run_svn(None, 'add', I_path)
upsilon_path = os.path.join(I_path, 'upsilon')
svntest.main.file_append(upsilon_path, "This is the file 'upsilon'\n")
svntest.main.run_svn(None, 'add', upsilon_path)
zeta_path = os.path.join(I_path, 'zeta')
svntest.main.file_append(zeta_path, "This is the file 'zeta'\n")
svntest.main.run_svn(None, 'add', zeta_path)
expected_output = wc.State(wc_dir, {
'A/mu' : Item(verb='Sending'),
'A/D/G/rho' : Item(verb='Sending'),
'A/B/F/nu' : Item(verb='Adding'),
'kappa' : Item(verb='Adding'),
'A/C/I' : Item(verb='Adding'),
'A/C/I/upsilon' : Item(verb='Adding'),
'A/C/I/zeta' : Item(verb='Adding'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.add({
'A/B/F/nu' : Item(status=' ', wc_rev=2),
'kappa' : Item(status=' ', wc_rev=2),
'A/C/I' : Item(status=' ', wc_rev=2),
'A/C/I/upsilon' : Item(status=' ', wc_rev=2),
'A/C/I/zeta' : Item(status=' ', wc_rev=2),
})
expected_status.tweak('A/mu', 'A/D/G/rho', wc_rev=2)
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
backup_mu_path = os.path.join(wc_backup, 'A', 'mu')
svntest.main.file_append(backup_mu_path, 'appended mu text')
nu_path = os.path.join(wc_backup, 'A', 'B', 'F', 'nu')
svntest.main.file_append(nu_path, "This is the file 'nu'\n")
kappa_path = os.path.join(wc_backup, 'kappa')
svntest.main.file_append(kappa_path,
"This is the OBSTRUCTING file 'kappa'\n")
I_path = os.path.join(wc_backup, 'A', 'C', 'I')
os.mkdir(I_path)
upsilon_path = os.path.join(I_path, 'upsilon')
svntest.main.file_append(upsilon_path,
"This is the OBSTRUCTING file 'upsilon'\n")
expected_output = wc.State(wc_backup, {
'A/mu' : Item(status='G '),
'A/D/G/rho' : Item(status='U '),
'kappa' : Item(status='E '),
'A/B/F/nu' : Item(status='E '),
'A/C/I' : Item(status='E '),
'A/C/I/upsilon' : Item(status='E '),
'A/C/I/zeta' : Item(status='A '),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.add({
'A/B/F/nu' : Item("This is the file 'nu'\n"),
'kappa' : Item("This is the OBSTRUCTING file 'kappa'\n"),
'A/C/I' : Item(),
'A/C/I/upsilon' : Item("This is the OBSTRUCTING file 'upsilon'\n"),
'A/C/I/zeta' : Item("This is the file 'zeta'\n"),
})
expected_disk.tweak('A/mu',
contents=expected_disk.desc['A/mu'].contents
+ 'appended mu text')
expected_disk.tweak('A/D/G/rho',
contents=expected_disk.desc['A/D/G/rho'].contents
+ 'new appended text for rho')
expected_status = svntest.actions.get_virginal_state(wc_backup, 2)
expected_status.add({
'A/B/F/nu' : Item(status=' ', wc_rev=2),
'A/C/I' : Item(status=' ', wc_rev=2),
'A/C/I/zeta' : Item(status=' ', wc_rev=2),
'kappa' : Item(status='M ', wc_rev=2),
'A/C/I/upsilon' : Item(status='M ', wc_rev=2),
})
svntest.actions.run_and_verify_update(wc_backup,
expected_output,
expected_disk,
expected_status,
None, None, None, None, None, 0,
wc_backup, '--force')
def forced_update_failures(sbox):
"forced up fails with some types of obstructions"
sbox.build()
wc_dir = sbox.wc_dir
wc_backup = sbox.add_wc_path('backup')
svntest.actions.duplicate_dir(wc_dir, wc_backup)
nu_path = os.path.join(wc_dir, 'A', 'B', 'F', 'nu')
svntest.main.file_append(nu_path, "This is the file 'nu'\n")
svntest.main.run_svn(None, 'add', nu_path)
I_path = os.path.join(wc_dir, 'A', 'C', 'I')
os.mkdir(I_path)
svntest.main.run_svn(None, 'add', I_path)
expected_output = wc.State(wc_dir, {
'A/B/F/nu' : Item(verb='Adding'),
'A/C/I' : Item(verb='Adding'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.add({
'A/B/F/nu' : Item(status=' ', wc_rev=2),
'A/C/I' : Item(status=' ', wc_rev=2),
})
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
nu_path = os.path.join(wc_backup, 'A', 'B', 'F', 'nu')
os.mkdir(nu_path)
I_path = os.path.join(wc_backup, 'A', 'C', 'I')
svntest.main.file_append(I_path,
"This is the file 'I'...shouldn't I be a dir?\n")
backup_A_B_F = os.path.join(wc_backup, 'A', 'B', 'F')
expected_output = svntest.wc.State(wc_backup, {
'A/B/F/nu' : Item(status=' ', treeconflict='C'),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.add({
'A/B/F/nu' : Item(),
'A/C/I' :
Item(contents="This is the file 'I'...shouldn't I be a dir?\n"),
})
expected_status = actions.get_virginal_state(wc_backup, 1)
expected_status.add({
'A/B/F/nu' : Item(status='D ', treeconflict='C', wc_rev='2'),
})
expected_status.tweak('A/B/F', wc_rev='2')
actions.run_and_verify_update(wc_backup, expected_output,
expected_disk, expected_status, None, None, None, None, None, False,
'--force', backup_A_B_F)
url = sbox.repo_url
wc_dir_backup = sbox.wc_dir + '.backup'
backup_A_B_F_nu = os.path.join(wc_dir_backup, 'A', 'B', 'F', 'nu')
backup_A_C = os.path.join(wc_dir_backup, 'A', 'C')
backup_A_C_I = os.path.join(wc_dir_backup, 'A', 'C', 'I')
url_A_C_I = url + '/A/C/I'
expected_output = svntest.wc.State(wc_dir_backup, {
'A/C/I' : Item(status=' ', treeconflict='C'),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.add({
'A/B/F/nu' : Item(),
'A/C/I' :
Item(contents="This is the file 'I'...shouldn't I be a dir?\n"),
})
expected_status = actions.get_virginal_state(wc_dir_backup, 1)
expected_status.add({
'A/C/I' : Item(status='D ', treeconflict='C', wc_rev=2),
'A/B/F/nu' : Item(status='D ', treeconflict='C', wc_rev=2),
})
expected_status.tweak('A/C', 'A/B/F', wc_rev='2')
actions.run_and_verify_update(wc_dir_backup, expected_output,
expected_disk, expected_status, None, None, None, None, None, False,
'--force', backup_A_C)
os.remove(backup_A_C_I)
svntest.main.safe_rmtree(backup_A_B_F_nu)
svntest.main.run_svn(None, 'revert', backup_A_C_I, backup_A_B_F_nu)
expected_output = svntest.wc.State(wc_dir_backup, {
})
expected_disk.tweak('A/B/F/nu', contents="This is the file 'nu'\n")
expected_disk.tweak('A/C/I', contents=None)
expected_status.tweak(wc_rev='2', status=' ')
expected_status.tweak('A/C/I', 'A/B/F/nu', treeconflict=None)
actions.run_and_verify_update(wc_dir_backup, expected_output,
expected_disk, expected_status, None, None, None, None, None, False,
wc_dir_backup)
expected_output = svntest.wc.State(wc_dir_backup, {
'A/C/I' : Item(status='D '),
})
expected_disk.remove('A/C/I')
expected_status.remove('A/C/I')
expected_status.tweak('A/C', wc_rev='1')
actions.run_and_verify_update(wc_dir_backup, expected_output,
expected_disk, expected_status, None, None, None, None, None, False,
'-r1', backup_A_C)
expected_output = svntest.wc.State(wc_dir_backup, {})
expected_disk = svntest.wc.State(wc_dir, {})
actions.run_and_verify_checkout2(False, url_A_C_I, backup_A_C_I,
expected_output, expected_disk, None, None, None, None)
expected_output = svntest.wc.State(wc_dir_backup, {
'A/C/I' : Item(verb='Skipped'),
})
actions.run_and_verify_update(wc_dir_backup, expected_output, None, None,
None, None, None, None, None, False, '--force', backup_A_C)
def update_wc_on_windows_drive(sbox):
"update wc on the root of a Windows (virtual) drive"
def find_the_next_available_drive_letter():
"find the first available drive"
try:
import win32api
drives=win32api.GetLogicalDriveStrings()
drives=drives.split('\000')
for d in range(ord('G'), ord('Z')+1):
drive = chr(d)
if not drive + ':\\' in drives:
return drive
except ImportError:
for d in range(ord('G'), ord('Z')+1):
drive = chr(d)
if not os.path.isdir(drive + ':\\'):
return drive
return None
if not svntest.main.windows:
raise svntest.Skip
sbox.build(create_wc = False)
svntest.main.safe_rmtree(sbox.wc_dir)
os.mkdir(sbox.wc_dir)
drive = find_the_next_available_drive_letter()
if drive is None:
raise svntest.Skip
subprocess.call(['subst', drive +':', sbox.wc_dir])
wc_dir = drive + ':/'
was_cwd = os.getcwd()
try:
svntest.actions.run_and_verify_svn(None, None, [],
'checkout',
sbox.repo_url, wc_dir)
mu_path = os.path.join(wc_dir, 'A', 'mu')
svntest.main.file_append(mu_path, '\nAppended text for mu')
zeta_path = os.path.join(wc_dir, 'zeta')
svntest.main.file_append(zeta_path, "This is the file 'zeta'\n")
svntest.main.run_svn(None, 'add', zeta_path)
expected_output = svntest.wc.State(wc_dir, {
'A/mu' : Item(verb='Sending'),
'zeta' : Item(verb='Adding'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('A/mu', wc_rev=2)
expected_status.add({
'zeta' : Item(status=' ', wc_rev=2),
})
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None,
wc_dir, zeta_path)
dir1_path = os.path.join(wc_dir, 'dir1')
os.mkdir(dir1_path)
svntest.main.run_svn(None, 'add', '-N', dir1_path)
file1_path = os.path.join(dir1_path, 'file1')
svntest.main.file_append(file1_path, "This is the file 'file1'\n")
svntest.main.run_svn(None, 'add', '-N', file1_path)
expected_output = svntest.wc.State(wc_dir, {
'dir1' : Item(verb='Adding'),
'dir1/file1' : Item(verb='Adding'),
})
expected_status.add({
'dir1' : Item(status=' ', wc_rev=3),
'dir1/file1' : Item(status=' ', wc_rev=3),
})
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None,
'-N',
wc_dir,
dir1_path, file1_path)
os.chdir(wc_dir)
expected_disk = svntest.main.greek_state.copy()
expected_output = svntest.wc.State('', {
'A/mu' : Item(status='U '),
'zeta' : Item(status='D '),
'dir1' : Item(status='D '),
})
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)
os.chdir(was_cwd)
wc_dir = drive + ":"
expected_output = svntest.wc.State(wc_dir, {
'A/mu' : Item(status='U '),
'zeta' : Item(status='A '),
'dir1' : Item(status='A '),
'dir1/file1' : Item(status='A '),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 3)
expected_status.add({
'dir1' : Item(status=' ', wc_rev=3),
'dir1/file1' : Item(status=' ', wc_rev=3),
'zeta' : Item(status=' ', wc_rev=3),
})
expected_disk.add({
'zeta' : Item("This is the file 'zeta'\n"),
'dir1/file1': Item("This is the file 'file1'\n"),
})
expected_disk.tweak('A/mu', contents = expected_disk.desc['A/mu'].contents
+ '\nAppended text for mu')
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status)
finally:
os.chdir(was_cwd)
subprocess.call(['subst', '/D', drive +':'])
def update_wc_with_replaced_file(sbox):
"update wc containing a replaced-with-history file"
sbox.build()
wc_dir = sbox.wc_dir
wc_backup = sbox.add_wc_path('backup')
svntest.actions.duplicate_dir(wc_dir, wc_backup)
iota_path = os.path.join(wc_dir, 'iota')
mu_path = os.path.join(wc_dir, 'A', 'mu')
iota_bu_path = os.path.join(wc_backup, 'iota')
svntest.main.file_append(iota_bu_path, "New line in 'iota'\n")
svntest.main.run_svn(None,
'ci', wc_backup, '-m', 'changed file')
svntest.main.run_svn(None, 'rm', iota_path)
svntest.main.file_append(iota_path, "")
svntest.main.run_svn(None, 'add', iota_path)
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('iota', status='R ', wc_rev='1')
svntest.actions.run_and_verify_status(wc_dir, expected_status)
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(status=' ', treeconflict='C'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
expected_status.add({
'iota' : Item(status='R ', wc_rev='2', treeconflict='C'),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.tweak('iota', contents="")
conflict_files = []
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status,
None,
svntest.tree.detect_conflict_files,
conflict_files)
svntest.main.run_svn(None, 'revert', iota_path)
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(status='U '),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_disk = svntest.main.greek_state.copy()
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status,
None,
None, None, None, None, 0,
wc_dir, '-r1')
svntest.main.run_svn(None, 'rm', iota_path)
svntest.main.run_svn(None, 'cp', mu_path, iota_path)
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('iota', status='R ', copied='+', wc_rev='-')
svntest.actions.run_and_verify_status(wc_dir, expected_status)
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(status=' ', treeconflict='C'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
expected_status.add({
'iota' : Item(status='R ', wc_rev='-', treeconflict='C', copied='+'),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.tweak('iota', contents="This is the file 'mu'.\n")
conflict_files = [ ]
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status,
None,
svntest.tree.detect_conflict_files,
conflict_files)
def update_with_obstructing_additions(sbox):
"update handles obstructing paths scheduled for add"
sbox.build()
wc_dir = sbox.wc_dir
wc_backup = sbox.add_wc_path('backup')
svntest.actions.duplicate_dir(wc_dir, wc_backup)
upsilon_path = os.path.join(wc_dir, 'A', 'B', 'upsilon')
svntest.main.file_append(upsilon_path, "This is the file 'upsilon'\n")
nu_path = os.path.join(wc_dir, 'A', 'C', 'nu')
svntest.main.file_append(nu_path, "This is the file 'nu'\n")
kappa_path = os.path.join(wc_dir, 'A', 'D', 'kappa')
svntest.main.file_append(kappa_path, "This is REPOS file 'kappa'\n")
epsilon_path = os.path.join(wc_dir, 'A', 'D', 'epsilon')
svntest.main.file_append(epsilon_path, "This is REPOS file 'epsilon'\n")
zeta_path = os.path.join(wc_dir, 'A', 'D', 'zeta')
svntest.main.file_append(zeta_path, "This is the file 'zeta'\n")
I_path = os.path.join(wc_dir, 'A', 'D', 'H', 'I')
os.mkdir(I_path)
J_path = os.path.join(I_path, 'J')
os.mkdir(J_path)
K_path = os.path.join(I_path, 'K')
os.mkdir(K_path)
L_path = os.path.join(I_path, 'L')
os.mkdir(L_path)
xi_path = os.path.join(K_path, 'xi')
svntest.main.file_append(xi_path, "This is the file 'xi'\n")
eta_path = os.path.join(J_path, 'eta')
svntest.main.file_append(eta_path, "This is REPOS file 'eta'\n")
svntest.main.run_svn(None, 'add', upsilon_path, nu_path,
kappa_path, epsilon_path, zeta_path, I_path)
svntest.main.run_svn(None, 'propset', 'propname1', 'propval-REPOS',
kappa_path)
svntest.main.run_svn(None, 'propset', 'propname1', 'propval-REPOS',
zeta_path)
svntest.main.run_svn(None, 'propset', 'propname1', 'propval-REPOS',
J_path)
svntest.main.run_svn(None, 'propset', 'propname1', 'propval-SAME',
epsilon_path)
svntest.main.run_svn(None, 'propset', 'propname1', 'propval-SAME',
K_path)
expected_output = wc.State(wc_dir, {
'A/B/upsilon' : Item(verb='Adding'),
'A/C/nu' : Item(verb='Adding'),
'A/D/kappa' : Item(verb='Adding'),
'A/D/epsilon' : Item(verb='Adding'),
'A/D/zeta' : Item(verb='Adding'),
'A/D/H/I' : Item(verb='Adding'),
'A/D/H/I/J' : Item(verb='Adding'),
'A/D/H/I/J/eta' : Item(verb='Adding'),
'A/D/H/I/K' : Item(verb='Adding'),
'A/D/H/I/K/xi' : Item(verb='Adding'),
'A/D/H/I/L' : Item(verb='Adding'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.add({
'A/B/upsilon' : Item(status=' ', wc_rev=2),
'A/C/nu' : Item(status=' ', wc_rev=2),
'A/D/kappa' : Item(status=' ', wc_rev=2),
'A/D/epsilon' : Item(status=' ', wc_rev=2),
'A/D/zeta' : Item(status=' ', wc_rev=2),
'A/D/H/I' : Item(status=' ', wc_rev=2),
'A/D/H/I/J' : Item(status=' ', wc_rev=2),
'A/D/H/I/J/eta' : Item(status=' ', wc_rev=2),
'A/D/H/I/K' : Item(status=' ', wc_rev=2),
'A/D/H/I/K/xi' : Item(status=' ', wc_rev=2),
'A/D/H/I/L' : Item(status=' ', wc_rev=2),
})
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
upsilon_backup_path = os.path.join(wc_backup, 'A', 'B', 'upsilon')
svntest.main.file_append(upsilon_backup_path,
"This is the file 'upsilon'\n")
kappa_backup_path = os.path.join(wc_backup, 'A', 'D', 'kappa')
svntest.main.file_append(kappa_backup_path,
"This is WC file 'kappa'\n")
epsilon_backup_path = os.path.join(wc_backup, 'A', 'D', 'epsilon')
svntest.main.file_append(epsilon_backup_path,
"This is WC file 'epsilon'\n")
zeta_backup_path = os.path.join(wc_backup, 'A', 'D', 'zeta')
svntest.main.file_append(zeta_backup_path, "This is the file 'zeta'\n")
I_backup_path = os.path.join(wc_backup, 'A', 'D', 'H', 'I')
os.mkdir(I_backup_path)
J_backup_path = os.path.join(I_backup_path, 'J')
os.mkdir(J_backup_path)
K_backup_path = os.path.join(I_backup_path, 'K')
os.mkdir(K_backup_path)
xi_backup_path = os.path.join(K_backup_path, 'xi')
svntest.main.file_append(xi_backup_path, "This is the file 'xi'\n")
eta_backup_path = os.path.join(J_backup_path, 'eta')
svntest.main.file_append(eta_backup_path, "This is WC file 'eta'\n")
svntest.main.run_svn(None, 'add', upsilon_backup_path, kappa_backup_path,
epsilon_backup_path, zeta_backup_path, I_backup_path)
svntest.main.run_svn(None, 'propset', 'propname1', 'propval-WC',
kappa_backup_path)
svntest.main.run_svn(None, 'propset', 'propname1', 'propval-WC',
zeta_backup_path)
svntest.main.run_svn(None, 'propset', 'propname1', 'propval-WC',
J_backup_path)
svntest.main.run_svn(None, 'propset', 'propname1', 'propval-SAME',
epsilon_backup_path)
svntest.main.run_svn(None, 'propset', 'propname1', 'propval-SAME',
K_backup_path)
expected_output = wc.State(wc_backup, {
'A/B/upsilon' : Item(status='E '),
'A/C/nu' : Item(status='A '),
'A/D/H/I' : Item(status='E '),
'A/D/H/I/J' : Item(status='EC'),
'A/D/H/I/J/eta' : Item(status='C '),
'A/D/H/I/K' : Item(status='EG'),
'A/D/H/I/K/xi' : Item(status='E '),
'A/D/H/I/L' : Item(status='A '),
'A/D/kappa' : Item(status='CC'),
'A/D/epsilon' : Item(status='CG'),
'A/D/zeta' : Item(status='EC'),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.add({
'A/B/upsilon' : Item("This is the file 'upsilon'\n"),
'A/C/nu' : Item("This is the file 'nu'\n"),
'A/D/H/I' : Item(),
'A/D/H/I/J' : Item(props={'propname1' : 'propval-WC'}),
'A/D/H/I/J/eta' : Item("\n".join(["<<<<<<< .mine",
"This is WC file 'eta'",
"=======",
"This is REPOS file 'eta'",
">>>>>>> .r2",
""])),
'A/D/H/I/K' : Item(props={'propname1' : 'propval-SAME'}),
'A/D/H/I/K/xi' : Item("This is the file 'xi'\n"),
'A/D/H/I/L' : Item(),
'A/D/kappa' : Item("\n".join(["<<<<<<< .mine",
"This is WC file 'kappa'",
"=======",
"This is REPOS file 'kappa'",
">>>>>>> .r2",
""]),
props={'propname1' : 'propval-WC'}),
'A/D/epsilon' : Item("\n".join(["<<<<<<< .mine",
"This is WC file 'epsilon'",
"=======",
"This is REPOS file 'epsilon'",
">>>>>>> .r2",
""]),
props={'propname1' : 'propval-SAME'}),
'A/D/zeta' : Item("This is the file 'zeta'\n",
props={'propname1' : 'propval-WC'}),
})
expected_status = svntest.actions.get_virginal_state(wc_backup, 2)
expected_status.add({
'A/B/upsilon' : Item(status=' ', wc_rev=2),
'A/C/nu' : Item(status=' ', wc_rev=2),
'A/D/H/I' : Item(status=' ', wc_rev=2),
'A/D/H/I/J' : Item(status=' C', wc_rev=2),
'A/D/H/I/J/eta' : Item(status='C ', wc_rev=2),
'A/D/H/I/K' : Item(status=' ', wc_rev=2),
'A/D/H/I/K/xi' : Item(status=' ', wc_rev=2),
'A/D/H/I/L' : Item(status=' ', wc_rev=2),
'A/D/kappa' : Item(status='CC', wc_rev=2),
'A/D/epsilon' : Item(status='C ', wc_rev=2),
'A/D/zeta' : Item(status=' C', wc_rev=2),
})
extra_files = ['eta\.r0', 'eta\.r2', 'eta\.mine',
'kappa\.r0', 'kappa\.r2', 'kappa\.mine',
'epsilon\.r0', 'epsilon\.r2', 'epsilon\.mine',
'kappa.prej', 'zeta.prej', 'dir_conflicts.prej']
svntest.actions.run_and_verify_update(wc_backup,
expected_output,
expected_disk,
expected_status,
None,
svntest.tree.detect_conflict_files,
extra_files, None, None, 1,
wc_backup)
G_URL = sbox.repo_url + '/A/D/G'
M_URL = sbox.repo_url + '/A/M'
svntest.actions.run_and_verify_svn("Copy error:", None, [],
'cp', G_URL, M_URL, '-m', '')
H_path = os.path.join(wc_dir, 'A', 'D', 'H')
A_path = os.path.join(wc_dir, 'A')
M_path = os.path.join(wc_dir, 'A', 'M')
svntest.actions.run_and_verify_svn("Copy error:", None, [],
'cp', H_path, M_path)
omega_URL = sbox.repo_url + '/A/D/H/omega'
omicron_URL = sbox.repo_url + '/omicron'
svntest.actions.run_and_verify_svn("Copy error:", None, [],
'cp', omega_URL, omicron_URL,
'-m', '')
chi_path = os.path.join(wc_dir, 'A', 'D', 'H', 'chi')
omicron_path = os.path.join(wc_dir, 'omicron')
svntest.actions.run_and_verify_svn("Copy error:", None, [],
'cp', chi_path,
omicron_path)
expected_output = wc.State(A_path, {
'M' : Item(status=' ', treeconflict='C'),
'M/rho' : Item(status=' ', treeconflict='A'),
'M/pi' : Item(status=' ', treeconflict='A'),
'M/tau' : Item(status=' ', treeconflict='A'),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.add({
'A/B/upsilon' : Item("This is the file 'upsilon'\n"),
'A/C/nu' : Item("This is the file 'nu'\n"),
'A/D/H/I' : Item(),
'A/D/H/I/J' : Item(),
'A/D/H/I/J/eta' : Item("This is REPOS file 'eta'\n"),
'A/D/H/I/K' : Item(),
'A/D/H/I/K/xi' : Item("This is the file 'xi'\n"),
'A/D/H/I/L' : Item(),
'A/D/kappa' : Item("This is REPOS file 'kappa'\n"),
'A/D/epsilon' : Item("This is REPOS file 'epsilon'\n"),
'A/D/gamma' : Item("This is the file 'gamma'.\n"),
'A/D/zeta' : Item("This is the file 'zeta'\n"),
'A/M/I' : Item(),
'A/M/I/J' : Item(),
'A/M/I/J/eta' : Item("This is REPOS file 'eta'\n"),
'A/M/I/K' : Item(),
'A/M/I/K/xi' : Item("This is the file 'xi'\n"),
'A/M/I/L' : Item(),
'A/M/chi' : Item("This is the file 'chi'.\n"),
'A/M/psi' : Item("This is the file 'psi'.\n"),
'A/M/omega' : Item("This is the file 'omega'.\n"),
'omicron' : Item("This is the file 'chi'.\n"),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 4)
expected_status.tweak('', 'iota', wc_rev=1)
expected_status.add({
'A/B/upsilon' : Item(status=' ', wc_rev=4),
'A/C/nu' : Item(status=' ', wc_rev=4),
'A/D/kappa' : Item(status=' ', wc_rev=4),
'A/D/epsilon' : Item(status=' ', wc_rev=4),
'A/D/gamma' : Item(status=' ', wc_rev=4),
'A/D/zeta' : Item(status=' ', wc_rev=4),
'A/D/H/I' : Item(status=' ', wc_rev=4),
'A/D/H/I/J' : Item(status=' ', wc_rev=4),
'A/D/H/I/J/eta' : Item(status=' ', wc_rev=4),
'A/D/H/I/K' : Item(status=' ', wc_rev=4),
'A/D/H/I/K/xi' : Item(status=' ', wc_rev=4),
'A/D/H/I/L' : Item(status=' ', wc_rev=4),
'A/M' : Item(status='R ', copied='+', wc_rev='-',
treeconflict='C'),
'A/M/I' : Item(status='A ', copied='+', wc_rev='-',
entry_status=' '), 'A/M/I/J' : Item(status=' ', copied='+', wc_rev='-'),
'A/M/I/J/eta' : Item(status=' ', copied='+', wc_rev='-'),
'A/M/I/K' : Item(status=' ', copied='+', wc_rev='-'),
'A/M/I/K/xi' : Item(status=' ', copied='+', wc_rev='-'),
'A/M/I/L' : Item(status=' ', copied='+', wc_rev='-'),
'A/M/chi' : Item(status=' ', copied='+', wc_rev='-'),
'A/M/psi' : Item(status=' ', copied='+', wc_rev='-'),
'A/M/omega' : Item(status=' ', copied='+', wc_rev='-'),
'omicron' : Item(status='A ', copied='+', wc_rev='-'),
'A/M/pi' : Item(status='D ', wc_rev='4'),
'A/M/rho' : Item(status='D ', wc_rev='4'),
'A/M/tau' : Item(status='D ', wc_rev='4'),
})
svntest.actions.run_and_verify_update(wc_dir, expected_output,
expected_disk, expected_status,
None, None, None, None, None, False,
A_path)
svntest.main.run_svn(None, 'resolve', '--accept', 'working', M_path)
expected_output = wc.State(wc_dir, {
'omicron' : Item(status=' ', treeconflict='C'),
})
expected_status.tweak('', 'iota', status=' ', wc_rev=4)
expected_status.tweak('omicron', status='R ', copied='+', wc_rev='-',
treeconflict='C')
expected_status.tweak('A/M', treeconflict=None)
svntest.actions.run_and_verify_update(wc_dir, expected_output,
expected_disk, expected_status,
None, None, None, None, None, False,
wc_dir, '-N')
svntest.main.run_svn(None, 'resolved', omicron_path)
expected_output = wc.State(wc_dir, { })
expected_status.tweak('omicron', treeconflict=None)
svntest.actions.run_and_verify_update(wc_dir, expected_output,
expected_disk, expected_status,
None, None, None, None, None, False,
omicron_path, '-N', '--force')
def update_conflicted(sbox):
"update conflicted files"
sbox.build()
wc_dir = sbox.wc_dir
iota_path = os.path.join(wc_dir, 'iota')
lambda_path = os.path.join(wc_dir, 'A', 'B', 'lambda')
mu_path = os.path.join(wc_dir, 'A', 'mu')
D_path = os.path.join(wc_dir, 'A', 'D')
pi_path = os.path.join(wc_dir, 'A', 'D', 'G', 'pi')
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
svntest.main.file_append(iota_path, 'Original appended text for iota\n')
svntest.main.run_svn(None, 'propset', 'prop', 'val', lambda_path)
svntest.main.file_append(mu_path, 'Original appended text for mu\n')
svntest.main.run_svn(None, 'propset', 'prop', 'val', mu_path)
svntest.main.run_svn(None, 'propset', 'prop', 'val', D_path)
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(verb='Sending'),
'A/mu': Item(verb='Sending'),
'A/B/lambda': Item(verb='Sending'),
'A/D': Item(verb='Sending'),
})
expected_status.tweak('iota', 'A/mu', 'A/B/lambda', 'A/D', wc_rev=2)
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
svntest.main.file_append(iota_path, 'Another line for iota\n')
svntest.main.file_append(mu_path, 'Another line for mu\n')
svntest.main.file_append(lambda_path, 'Another line for lambda\n')
svntest.main.run_svn(None, 'propset', 'prop', 'val2', D_path)
svntest.main.file_append(pi_path, 'Another line for pi\n')
expected_status.tweak('iota', 'A/mu', 'A/B/lambda', 'A/D', 'A/D/G/pi',
wc_rev=3)
expected_output.add({
'A/D/G/pi': Item(verb='Sending')})
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(status='U '),
'A/B/lambda' : Item(status='UU'),
'A/mu' : Item(status='UU'),
'A/D': Item(status=' U'),
'A/D/G/pi': Item(status='U '),
})
expected_disk = svntest.main.greek_state.copy()
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, 1,
'-r1', wc_dir)
svntest.main.file_append(iota_path, 'Conflicting appended text for iota\n')
svntest.main.run_svn(None, 'propset', 'prop', 'conflictval', lambda_path)
svntest.main.file_append(mu_path, 'Conflicting appended text for mu\n')
svntest.main.run_svn(None, 'propset', 'prop', 'conflictval', mu_path)
svntest.main.run_svn(None, 'propset', 'prop', 'conflictval', D_path)
expected_output = svntest.wc.State(wc_dir, {
'iota': Item(status='C '),
'A/B/lambda': Item(status=' C'),
'A/mu': Item(status='CC'),
'A/D': Item(status=' C'),
})
expected_disk.tweak('iota',
contents="\n".join(["This is the file 'iota'.",
"<<<<<<< .mine",
"Conflicting appended text for iota",
"=======",
"Original appended text for iota",
">>>>>>> .r2",
""]))
expected_disk.tweak('A/mu',
contents="\n".join(["This is the file 'mu'.",
"<<<<<<< .mine",
"Conflicting appended text for mu",
"=======",
"Original appended text for mu",
">>>>>>> .r2",
""]),
props={'prop': 'conflictval'})
expected_disk.tweak('A/B/lambda', 'A/D', props={'prop': 'conflictval'})
expected_status.tweak(wc_rev=2)
expected_status.tweak('iota', status='C ')
expected_status.tweak('A/B/lambda', 'A/D', status=' C')
expected_status.tweak('A/mu', status='CC')
extra_files = [ [wc_dir, 'iota.*\.(r1|r2|mine)'],
[wc_dir, 'mu.*\.(r1|r2|mine|prej)'],
[wc_dir, 'lambda.*\.prej'],
[wc_dir, 'dir_conflicts.prej']]
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status,
None,
detect_extra_files, extra_files,
None, None, 1,
'-r2', wc_dir)
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(verb='Skipped'),
'A/B/lambda' : Item(verb='Skipped'),
'A/mu' : Item(verb='Skipped'),
'A/D' : Item(verb='Skipped'),
})
expected_status.tweak(wc_rev=3)
expected_status.tweak('iota', 'A/B/lambda', 'A/mu', 'A/D', wc_rev=2)
expected_status.tweak('A/D/G',
'A/D/G/pi',
'A/D/G/rho',
'A/D/G/tau',
'A/D/H',
'A/D/H/chi',
'A/D/H/omega',
'A/D/H/psi',
'A/D/gamma', wc_rev=2)
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status,
None,
detect_extra_files, extra_files,
None, None, 1)
@SkipUnless(server_has_mergeinfo)
def mergeinfo_update_elision(sbox):
"mergeinfo does not elide after update"
sbox.build()
wc_dir = sbox.wc_dir
alpha_COPY_path = os.path.join(wc_dir, "A", "B_COPY", "E", "alpha")
alpha_path = os.path.join(wc_dir, "A", "B", "E", "alpha")
B_COPY_path = os.path.join(wc_dir, "A", "B_COPY")
E_COPY_path = os.path.join(wc_dir, "A", "B_COPY", "E")
beta_path = os.path.join(wc_dir, "A", "B", "E", "beta")
lambda_path = os.path.join(wc_dir, "A", "B", "lambda")
expected_stdout = verify.UnorderedOutput([
"A " + os.path.join(wc_dir, "A", "B_COPY", "lambda") + "\n",
"A " + os.path.join(wc_dir, "A", "B_COPY", "E") + "\n",
"A " + os.path.join(wc_dir, "A", "B_COPY", "E", "alpha") + "\n",
"A " + os.path.join(wc_dir, "A", "B_COPY", "E", "beta") + "\n",
"A " + os.path.join(wc_dir, "A", "B_COPY", "F") + "\n",
"Checked out revision 1.\n",
"A " + B_COPY_path + "\n",
])
svntest.actions.run_and_verify_svn(None, expected_stdout, [], 'copy',
sbox.repo_url + "/A/B", B_COPY_path)
expected_output = wc.State(wc_dir, {'A/B_COPY' : Item(verb='Adding')})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.add({
"A/B_COPY" : Item(status=' ', wc_rev=2),
"A/B_COPY/lambda" : Item(status=' ', wc_rev=2),
"A/B_COPY/E" : Item(status=' ', wc_rev=2),
"A/B_COPY/E/alpha" : Item(status=' ', wc_rev=2),
"A/B_COPY/E/beta" : Item(status=' ', wc_rev=2),
"A/B_COPY/F" : Item(status=' ', wc_rev=2),})
svntest.actions.run_and_verify_commit(wc_dir,
expected_output,
expected_status,
None,
wc_dir)
svntest.main.file_write(beta_path, "New content")
expected_output = wc.State(wc_dir, {'A/B/E/beta' : Item(verb='Sending')})
expected_status.tweak('A/B/E/beta', wc_rev=3)
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
svntest.main.file_write(lambda_path, "New content")
expected_output = wc.State(wc_dir, {'A/B/lambda' : Item(verb='Sending')})
expected_status.tweak('A/B/lambda', wc_rev=4)
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
svntest.main.file_write(alpha_path, "New content")
expected_output = wc.State(wc_dir, {'A/B/E/alpha' : Item(verb='Sending')})
expected_status.tweak('A/B/E/alpha', wc_rev=5)
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
expected_output = wc.State(B_COPY_path, {
'lambda' : Item(status='U '),
'E/alpha' : Item(status='U '),
'E/beta' : Item(status='U '),
})
expected_mergeinfo_output = wc.State(B_COPY_path, {
'' : Item(status=' U'),
})
expected_elision_output = wc.State(B_COPY_path, {
})
expected_merge_status = wc.State(B_COPY_path, {
'' : Item(status=' M', wc_rev=2),
'lambda' : Item(status='M ', wc_rev=2),
'E' : Item(status=' ', wc_rev=2),
'E/alpha' : Item(status='M ', wc_rev=2),
'E/beta' : Item(status='M ', wc_rev=2),
'F' : Item(status=' ', wc_rev=2),
})
expected_merge_disk = wc.State('', {
'' : Item(props={SVN_PROP_MERGEINFO : '/A/B:3-5'}),
'lambda' : Item("New content"),
'E' : Item(),
'E/alpha' : Item("New content"),
'E/beta' : Item("New content"),
'F' : Item(),
})
expected_skip = wc.State(B_COPY_path, { })
svntest.actions.run_and_verify_merge(B_COPY_path, '2', '5',
sbox.repo_url + '/A/B', None,
expected_output,
expected_mergeinfo_output,
expected_elision_output,
expected_merge_disk,
expected_merge_status,
expected_skip,
None, None, None, None,
None, 1)
expected_output = wc.State(wc_dir,
{'A/B_COPY' : Item(verb='Sending'),
'A/B_COPY/E/alpha' : Item(verb='Sending'),
'A/B_COPY/E/beta' : Item(verb='Sending'),
'A/B_COPY/lambda' : Item(verb='Sending')})
expected_status.tweak('A/B_COPY', wc_rev=6)
expected_status.tweak('A/B_COPY/E/alpha', wc_rev=6)
expected_status.tweak('A/B_COPY/E/beta', wc_rev=6)
expected_status.tweak('A/B_COPY/lambda', wc_rev=6)
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
expected_output = wc.State(wc_dir,
{'A/B_COPY' : Item(status=' U'),
'A/B_COPY/E/alpha' : Item(status='U '),
'A/B_COPY/E/beta' : Item(status='U '),
'A/B_COPY/lambda' : Item(status='U '),})
expected_status.tweak(wc_rev=5)
expected_disk = svntest.main.greek_state.copy()
expected_disk.add({
'A/B_COPY' : Item(),
'A/B_COPY/lambda' : Item("This is the file 'lambda'.\n"),
'A/B_COPY/E' : Item(),
'A/B_COPY/E/alpha' : Item("This is the file 'alpha'.\n"),
'A/B_COPY/E/beta' : Item("This is the file 'beta'.\n"),
'A/B_COPY/F' : Item(),
})
expected_disk.tweak('A/B/lambda', contents="New content")
expected_disk.tweak('A/B/E/alpha', contents="New content")
expected_disk.tweak('A/B/E/beta', contents="New content")
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status,
None, None, None,
None, None, 1,
'-r', '5', wc_dir)
expected_output = wc.State(alpha_COPY_path, {
'alpha' : Item(status='U '),
})
expected_skip = wc.State(alpha_COPY_path, { })
svntest.actions.run_and_verify_svn(None,
expected_merge_output([[3,5]],
['U ' + alpha_COPY_path + '\n',
' U ' + alpha_COPY_path + '\n']),
[], 'merge', '-r2:5',
sbox.repo_url + '/A/B/E/alpha',
alpha_COPY_path)
expected_alpha_status = wc.State(alpha_COPY_path, {
'' : Item(status='MM', wc_rev=5),
})
svntest.actions.run_and_verify_status(alpha_COPY_path,
expected_alpha_status)
svntest.actions.run_and_verify_svn(None, ["/A/B/E/alpha:3-5\n"], [],
'propget', SVN_PROP_MERGEINFO,
alpha_COPY_path)
expected_output = wc.State(wc_dir, {
'A/B_COPY/lambda' : Item(status='U '),
'A/B_COPY/E/alpha' : Item(status='G '),
'A/B_COPY/E/beta' : Item(status='U '),
'A/B_COPY' : Item(status=' U'),
})
expected_disk.tweak('A/B_COPY', props={SVN_PROP_MERGEINFO : '/A/B:3-5'})
expected_disk.tweak('A/B_COPY/lambda', contents="New content")
expected_disk.tweak('A/B_COPY/E/beta', contents="New content")
expected_disk.tweak('A/B_COPY/E/alpha', contents="New content",
props={SVN_PROP_MERGEINFO : '/A/B/E/alpha:3-5'})
expected_status.tweak(wc_rev=6)
expected_status.tweak('A/B_COPY/E/alpha', status=' M')
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status,
None, None, None,
None, None, 1)
svntest.main.file_write(alpha_path, "More new content")
expected_output = wc.State(wc_dir, {
'A/B/E/alpha' : Item(verb='Sending'),
'A/B_COPY/E/alpha' : Item(verb='Sending')})
expected_status.tweak('A/B/E/alpha', 'A/B_COPY/E/alpha', status=' ',
wc_rev=7)
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
svntest.actions.run_and_verify_svn(None, exp_noop_up_out(7), [],
'up', wc_dir)
expected_output = wc.State(E_COPY_path, {
'alpha' : Item(status='U '),
})
expected_mergeinfo_output = wc.State(E_COPY_path, {
'' : Item(status=' G'),
'alpha' : Item(status=' U'),
})
expected_elision_output = wc.State(E_COPY_path, {
'alpha' : Item(status=' U'),
})
expected_merge_status = wc.State(E_COPY_path, {
'' : Item(status=' M', wc_rev=7),
'alpha' : Item(status='MM', wc_rev=7),
'beta' : Item(status=' ', wc_rev=7),
})
expected_merge_disk = wc.State('', {
'' : Item(props={SVN_PROP_MERGEINFO : '/A/B/E:3-5,7'}),
'alpha' : Item("More new content"),
'beta' : Item("New content"),
})
expected_skip = wc.State(E_COPY_path, { })
svntest.actions.run_and_verify_merge(E_COPY_path, '6', '7',
sbox.repo_url + '/A/B/E', None,
expected_output,
expected_mergeinfo_output,
expected_elision_output,
expected_merge_disk,
expected_merge_status,
expected_skip,
None, None, None, None,
None, 1)
svntest.actions.run_and_verify_svn(None,
exp_noop_up_out(7),
[], 'update', wc_dir)
expected_output = wc.State(wc_dir,
{'A/B_COPY/E' : Item(verb='Sending'),
'A/B_COPY/E/alpha' : Item(verb='Sending')})
expected_status.tweak(wc_rev=7)
expected_status.tweak('A/B_COPY/E', 'A/B_COPY/E/alpha', wc_rev=8)
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
expected_output = wc.State(wc_dir, {
'A/B_COPY/E/alpha' : Item(status='UU'),
'A/B_COPY/E' : Item(status=' U'),
})
expected_status.tweak(wc_rev=7)
expected_disk.tweak('A/B_COPY',
props={SVN_PROP_MERGEINFO : '/A/B:3-5'})
expected_disk.tweak('A/B/E/alpha', contents="More new content")
expected_disk.tweak('A/B_COPY/E/alpha', contents="New content")
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status,
None, None, None,
None, None, 1,
'-r', '7', E_COPY_path)
expected_output = wc.State(B_COPY_path, {
'E/alpha' : Item(status='U '),
})
expected_mergeinfo_output = wc.State(B_COPY_path, {
'' : Item(status=' U'),
'E/alpha' : Item(status=' U'),
})
expected_elision_output = wc.State(B_COPY_path, {
'E/alpha' : Item(status=' U'),
})
expected_merge_status = wc.State(B_COPY_path, {
'' : Item(status=' M', wc_rev=7),
'lambda' : Item(status=' ', wc_rev=7),
'E' : Item(status=' ', wc_rev=7),
'E/alpha' : Item(status='MM', wc_rev=7),
'E/beta' : Item(status=' ', wc_rev=7),
'F' : Item(status=' ', wc_rev=7),
})
expected_merge_disk = wc.State('', {
'' : Item(props={SVN_PROP_MERGEINFO : '/A/B:3-5,7'}),
'lambda' : Item("New content"),
'E' : Item(),
'E/alpha' : Item("More new content"),
'E/beta' : Item("New content"),
'F' : Item(),
})
expected_skip = wc.State(B_COPY_path, { })
svntest.actions.run_and_verify_merge(B_COPY_path, '6', '7',
sbox.repo_url + '/A/B', None,
expected_output,
expected_mergeinfo_output,
expected_elision_output,
expected_merge_disk,
expected_merge_status,
expected_skip,
None, None, None, None,
None, 1,alpha_COPY_path)
expected_output = wc.State(wc_dir, {
'A/B_COPY/E/alpha' : Item(status='GG'),
'A/B_COPY/E/' : Item(status=' U'),
})
expected_status.tweak('A/B_COPY', status=' M', wc_rev=7)
expected_status.tweak('A/B_COPY/E', status=' ', wc_rev=8)
expected_status.tweak('A/B_COPY/E/alpha', wc_rev=8)
expected_status.tweak('A/B_COPY/E/beta', wc_rev=8)
expected_disk.tweak('A/B_COPY',
props={SVN_PROP_MERGEINFO : '/A/B:3-5,7'})
expected_disk.tweak('A/B_COPY/E',
props={SVN_PROP_MERGEINFO : '/A/B/E:3-5,7'})
expected_disk.tweak('A/B_COPY/E/alpha', contents="More new content",
props={})
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status,
None, None, None,
None, None, 1, E_COPY_path)
def update_copied_from_replaced_and_changed(sbox):
"update chooses right copyfrom for double move"
sbox.build()
wc_dir = sbox.wc_dir
fn1_relpath = os.path.join('A', 'B', 'E', 'aardvark')
fn2_relpath = os.path.join('A', 'B', 'E', 'alpha')
fn3_relpath = os.path.join('A', 'B', 'E', 'beta')
fn1_path = os.path.join(wc_dir, fn1_relpath)
fn2_path = os.path.join(wc_dir, fn2_relpath)
fn3_path = os.path.join(wc_dir, fn3_relpath)
svntest.actions.run_and_verify_svn(None, None, [],
'mv', fn2_path, fn1_path)
svntest.actions.run_and_verify_svn(None, None, [],
'mv', fn3_path, fn2_path)
expected_output = svntest.wc.State(wc_dir, {
fn1_relpath : Item(verb='Adding'),
fn2_relpath : Item(verb='Replacing'),
fn3_relpath : Item(verb='Deleting'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.remove(fn2_relpath, fn3_relpath)
expected_status.add({
fn1_relpath : Item(status=' ', wc_rev=2),
fn2_relpath : Item(status=' ', wc_rev=2),
})
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
fn2_final_contents = "I have new contents for the middle file."
svntest.main.file_write(fn2_path, fn2_final_contents)
expected_output = svntest.wc.State(wc_dir, {
fn2_relpath : Item(verb='Sending'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.remove(fn2_relpath, fn3_relpath)
expected_status.add({
fn1_relpath : Item(status=' ', wc_rev=2),
fn2_relpath : Item(status=' ', wc_rev=3),
})
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
expected_output = svntest.wc.State(wc_dir, {
fn1_relpath: Item(status='D '),
fn2_relpath: Item(status='A '), fn3_relpath: Item(status='A '),
})
expected_disk = svntest.main.greek_state.copy()
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
None, None,
None, None, None, None, 0,
'-r', '1', wc_dir)
expected_output = svntest.wc.State(wc_dir, {
fn1_relpath: Item(status='A '),
fn2_relpath: Item(status='A '), fn3_relpath: Item(status='D '),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.add({
fn1_relpath : Item("This is the file 'alpha'.\n"),
})
expected_disk.tweak(fn2_relpath, contents=fn2_final_contents)
expected_disk.remove(fn3_relpath)
expected_status.tweak(wc_rev=3)
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status, None,
None, None, None, None, 0,
wc_dir)
def update_copied_and_deleted_prop(sbox):
"updating a copied file with a deleted property"
sbox.build()
wc_dir = sbox.wc_dir
iota_path = os.path.join(wc_dir, 'iota')
iota2_path = os.path.join(wc_dir, 'iota2')
svntest.actions.run_and_verify_svn(None, None, [],
'propset', 'foo', 'bar', iota_path)
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(verb='Sending'),
})
expected_status_mixed = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status_mixed.tweak('iota', wc_rev=2)
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status_mixed, None, wc_dir)
svntest.actions.run_and_verify_svn(None, None, [],
'copy', iota_path, iota2_path)
svntest.actions.run_and_verify_svn(None, None, [],
'propdel', 'foo', iota2_path)
expected_output = svntest.wc.State(wc_dir, {
'iota2' : Item(verb='Adding'),
})
expected_status_mixed.add({
'iota2' : Item(status=' ', wc_rev=3),
})
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status_mixed, None, wc_dir)
expected_output = svntest.wc.State(wc_dir, { })
expected_disk_r3 = svntest.main.greek_state.copy()
expected_disk_r3.add({
'iota2' : Item("This is the file 'iota'.\n"),
})
expected_disk_r3.tweak('iota', props={'foo':'bar'})
expected_status_r3 = expected_status_mixed.copy()
expected_status_r3.tweak(wc_rev=3)
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk_r3,
expected_status_r3,
check_props=True)
expected_output = svntest.wc.State(wc_dir, {'iota2': Item(status='D ')})
expected_disk_r2 = expected_disk_r3.copy()
expected_disk_r2.remove('iota2')
expected_status_r2 = expected_status_r3.copy()
expected_status_r2.tweak(wc_rev=2)
expected_status_r2.remove('iota2')
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk_r2,
expected_status_r2,
None, None, None, None, None,
True,
"-r2", wc_dir)
expected_output = svntest.wc.State(wc_dir, {'iota2': Item(status='A ')})
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk_r3,
expected_status_r3,
check_props=True)
def update_accept_conflicts(sbox):
"update --accept automatic conflict resolution"
sbox.build()
wc_dir = sbox.wc_dir
wc_backup = sbox.add_wc_path('backup')
svntest.actions.duplicate_dir(wc_dir, wc_backup)
iota_path = os.path.join(wc_dir, 'iota')
lambda_path = os.path.join(wc_dir, 'A', 'B', 'lambda')
mu_path = os.path.join(wc_dir, 'A', 'mu')
alpha_path = os.path.join(wc_dir, 'A', 'B', 'E', 'alpha')
beta_path = os.path.join(wc_dir, 'A', 'B', 'E', 'beta')
pi_path = os.path.join(wc_dir, 'A', 'D', 'G', 'pi')
rho_path = os.path.join(wc_dir, 'A', 'D', 'G', 'rho')
svntest.main.file_append(lambda_path, 'Their appended text for lambda\n')
svntest.main.file_append(iota_path, 'Their appended text for iota\n')
svntest.main.file_append(mu_path, 'Their appended text for mu\n')
svntest.main.file_append(alpha_path, 'Their appended text for alpha\n')
svntest.main.file_append(beta_path, 'Their appended text for beta\n')
svntest.main.file_append(pi_path, 'Their appended text for pi\n')
svntest.main.file_append(rho_path, 'Their appended text for rho\n')
iota_path_backup = os.path.join(wc_backup, 'iota')
lambda_path_backup = os.path.join(wc_backup, 'A', 'B', 'lambda')
mu_path_backup = os.path.join(wc_backup, 'A', 'mu')
alpha_path_backup = os.path.join(wc_backup, 'A', 'B', 'E', 'alpha')
beta_path_backup = os.path.join(wc_backup, 'A', 'B', 'E', 'beta')
pi_path_backup = os.path.join(wc_backup, 'A', 'D', 'G', 'pi')
rho_path_backup = os.path.join(wc_backup, 'A', 'D', 'G', 'rho')
svntest.main.file_append(iota_path_backup,
'My appended text for iota\n')
svntest.main.file_append(lambda_path_backup,
'My appended text for lambda\n')
svntest.main.file_append(mu_path_backup,
'My appended text for mu\n')
svntest.main.file_append(alpha_path_backup,
'My appended text for alpha\n')
svntest.main.file_append(beta_path_backup,
'My appended text for beta\n')
svntest.main.file_append(pi_path_backup,
'My appended text for pi\n')
svntest.main.file_append(rho_path_backup,
'My appended text for rho\n')
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(verb='Sending'),
'A/B/lambda' : Item(verb='Sending'),
'A/mu' : Item(verb='Sending'),
'A/B/E/alpha': Item(verb='Sending'),
'A/B/E/beta': Item(verb='Sending'),
'A/D/G/pi' : Item(verb='Sending'),
'A/D/G/rho' : Item(verb='Sending'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('iota', wc_rev=2)
expected_status.tweak('A/B/lambda', wc_rev=2)
expected_status.tweak('A/mu', wc_rev=2)
expected_status.tweak('A/B/E/alpha', wc_rev=2)
expected_status.tweak('A/B/E/beta', wc_rev=2)
expected_status.tweak('A/D/G/pi', wc_rev=2)
expected_status.tweak('A/D/G/rho', wc_rev=2)
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
svntest.main.use_editor('append_foo')
svntest.actions.run_and_verify_svn(None,
["Updating '%s':\n" % (iota_path_backup),
'C %s\n' % (iota_path_backup,),
'Updated to revision 2.\n',
'Summary of conflicts:\n',
' Text conflicts: 1\n'],
[],
'update', iota_path_backup)
svntest.actions.run_and_verify_svn(None,
["Updating '%s':\n" % (lambda_path_backup),
'C %s\n' % (lambda_path_backup,),
'Updated to revision 2.\n',
'Summary of conflicts:\n',
' Text conflicts: 1\n'],
[],
'update', '--accept=postpone',
lambda_path_backup)
svntest.actions.run_and_verify_svn(None,
["Updating '%s':\n" % (mu_path_backup),
'G %s\n' % (mu_path_backup,),
'Updated to revision 2.\n'],
[],
'update', '--accept=base',
mu_path_backup)
svntest.actions.run_and_verify_svn(None,
["Updating '%s':\n" % (alpha_path_backup),
'G %s\n' % (alpha_path_backup,),
'Updated to revision 2.\n'],
[],
'update', '--accept=mine-full',
alpha_path_backup)
svntest.actions.run_and_verify_svn(None,
["Updating '%s':\n" % (beta_path_backup),
'G %s\n' % (beta_path_backup,),
'Updated to revision 2.\n'],
[],
'update', '--accept=theirs-full',
beta_path_backup)
svntest.actions.run_and_verify_svn2(None,
["Updating '%s':\n" % (pi_path_backup),
'G %s\n' % (pi_path_backup,),
'Updated to revision 2.\n'],
"system(.*) returned.*", 0,
'update', '--accept=edit',
pi_path_backup)
svntest.actions.run_and_verify_svn(None,
["Updating '%s':\n" % (rho_path_backup),
'C %s\n' % (rho_path_backup,),
'Updated to revision 2.\n',
'Summary of conflicts:\n',
' Text conflicts: 1\n'],
[],
'update', '--accept=launch',
rho_path_backup)
expected_disk = svntest.main.greek_state.copy()
expected_disk.tweak('iota', contents=("This is the file 'iota'.\n"
'<<<<<<< .mine\n'
'My appended text for iota\n'
'=======\n'
'Their appended text for iota\n'
'>>>>>>> .r2\n'))
expected_disk.tweak('A/B/lambda', contents=("This is the file 'lambda'.\n"
'<<<<<<< .mine\n'
'My appended text for lambda\n'
'=======\n'
'Their appended text for lambda\n'
'>>>>>>> .r2\n'))
expected_disk.tweak('A/mu', contents="This is the file 'mu'.\n")
expected_disk.tweak('A/B/E/alpha', contents=("This is the file 'alpha'.\n"
'My appended text for alpha\n'))
expected_disk.tweak('A/B/E/beta', contents=("This is the file 'beta'.\n"
'Their appended text for beta\n'))
expected_disk.tweak('A/D/G/pi', contents=("This is the file 'pi'.\n"
'<<<<<<< .mine\n'
'My appended text for pi\n'
'=======\n'
'Their appended text for pi\n'
'>>>>>>> .r2\n'
'foo\n'))
expected_disk.tweak('A/D/G/rho', contents=("This is the file 'rho'.\n"
'<<<<<<< .mine\n'
'My appended text for rho\n'
'=======\n'
'Their appended text for rho\n'
'>>>>>>> .r2\n'
'foo\n'))
extra_files = ['iota.*\.r1', 'iota.*\.r2', 'iota.*\.mine',
'lambda.*\.r1', 'lambda.*\.r2', 'lambda.*\.mine',
'rho.*\.r1', 'rho.*\.r2', 'rho.*\.mine']
expected_status = svntest.actions.get_virginal_state(wc_backup, 2)
expected_status.tweak('iota', 'A/B/lambda', 'A/mu',
'A/B/E/alpha', 'A/B/E/beta',
'A/D/G/pi', 'A/D/G/rho', wc_rev=2)
expected_status.tweak('iota', status='C ')
expected_status.tweak('A/B/lambda', status='C ')
expected_status.tweak('A/mu', status='M ')
expected_status.tweak('A/B/E/alpha', status='M ')
expected_status.tweak('A/B/E/beta', status=' ')
expected_status.tweak('A/D/G/pi', status='M ')
expected_status.tweak('A/D/G/rho', status='C ')
expected_output = wc.State(wc_backup, {})
svntest.actions.run_and_verify_update(wc_backup,
expected_output,
expected_disk,
expected_status,
None,
svntest.tree.detect_conflict_files,
extra_files)
def eof_in_interactive_conflict_resolver(sbox):
"eof in interactive resolution can't break wc"
sbox.build()
wc_dir = sbox.wc_dir
config_contents = '''\
[auth]
password-stores =
[miscellany]
interactive-conflicts = true
'''
tmp_dir = os.path.abspath(svntest.main.temp_dir)
config_dir = os.path.join(tmp_dir, 'interactive-conflicts-config')
svntest.main.create_config_dir(config_dir, config_contents)
iota_path = os.path.join(wc_dir, 'iota')
svntest.main.file_append(iota_path, "Appended text in r2.\n")
expected_output = svntest.wc.State(wc_dir, {
'iota': Item(verb="Sending"),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('iota', wc_rev=2)
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(status='U '),
})
expected_disk = svntest.main.greek_state.copy()
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, 1,
'-r1', wc_dir)
svntest.main.file_append(iota_path, "Local mods to r1 text.\n")
svntest.actions.run_and_verify_update(wc_dir, None, None, None,
"Can't read stdin: End of file found",
None, None, None, None, 1,
wc_dir, '--config-dir', config_dir)
expected_output = svntest.wc.State(wc_dir, {})
expected_disk.tweak('iota', contents=("This is the file 'iota'.\n"
"Local mods to r1 text.\n"))
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('iota', status='M ')
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status,
None,
None, None,
None, None, 1,
'-r1', wc_dir)
def update_uuid_changed(sbox):
"update fails when repos uuid changed"
sbox.build(read_only = False)
wc_dir = sbox.wc_dir
repo_dir = sbox.repo_dir
uuid_before = svntest.actions.get_wc_uuid(wc_dir)
svntest.actions.run_and_verify_svnadmin(None, None, [],
'setuuid', repo_dir)
svntest.actions.run_and_verify_svn(None, None, '.*UUID.*',
'update', wc_dir)
uuid_after = svntest.actions.get_wc_uuid(wc_dir)
if uuid_before != uuid_after:
raise svntest.Failure
def restarted_update_should_delete_dir_prop(sbox):
"restarted update should delete dir prop"
sbox.build()
wc_dir = sbox.wc_dir
A_path = os.path.join(wc_dir, 'A')
zeta_path = os.path.join(A_path, 'zeta')
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
svntest.main.run_svn(None, 'propset', 'prop', 'val', A_path)
expected_output = svntest.wc.State(wc_dir, {
'A': Item(verb='Sending'),
})
expected_status.tweak('A', wc_rev=2)
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
other_wc = sbox.add_wc_path('other')
svntest.actions.duplicate_dir(wc_dir, other_wc)
other_A_path = os.path.join(other_wc, 'A')
other_zeta_path = os.path.join(other_wc, 'A', 'zeta')
svntest.main.run_svn(None, 'propdel', 'prop', other_A_path)
svntest.main.file_write(other_zeta_path, 'New file\n')
svntest.main.run_svn(None, 'add', other_zeta_path)
expected_output = svntest.wc.State(other_wc, {
'A': Item(verb='Sending'),
'A/zeta' : Item(verb='Adding'),
})
expected_status = svntest.actions.get_virginal_state(other_wc, 1)
expected_status.tweak('A', wc_rev=3)
expected_status.add({
'A/zeta' : Item(status=' ', wc_rev=3),
})
svntest.actions.run_and_verify_commit(other_wc, expected_output,
expected_status, None, other_wc)
svntest.main.file_write(zeta_path, 'Obstructing file\n')
expected_output = svntest.wc.State(wc_dir, {
'A' : Item(status=' U'),
'A/zeta' : Item(status=' ', treeconflict='C'),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.add({
'A/zeta' : Item(contents="Obstructing file\n"),
})
expected_status = actions.get_virginal_state(wc_dir, 3)
expected_status.add({
'A/zeta' : Item(status='D ', treeconflict='C', wc_rev='3'),
})
actions.run_and_verify_update(wc_dir, expected_output, expected_disk,
expected_status, None, None, None, None, None, False, wc_dir)
os.unlink(zeta_path)
svntest.main.run_svn(None, 'revert', zeta_path)
expected_output = svntest.wc.State(wc_dir, {
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.tweak('A', props = {})
expected_disk.add({
'A/zeta' : Item("New file\n"),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 3)
expected_status.add({
'A/zeta' : Item(status=' ', wc_rev=3),
})
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status,
check_props = True)
leaf_edit = svntest.actions.deep_trees_leaf_edit
tree_del = svntest.actions.deep_trees_tree_del
leaf_del = svntest.actions.deep_trees_leaf_del
disk_after_leaf_edit = svntest.actions.deep_trees_after_leaf_edit
disk_after_leaf_del = svntest.actions.deep_trees_after_leaf_del
disk_after_tree_del = svntest.actions.deep_trees_after_tree_del
disk_empty_dirs = svntest.actions.deep_trees_empty_dirs
deep_trees_conflict_output = svntest.actions.deep_trees_conflict_output
deep_trees_conflict_output_skipped = \
svntest.actions.deep_trees_conflict_output_skipped
deep_trees_status_local_tree_del = \
svntest.actions.deep_trees_status_local_tree_del
deep_trees_status_local_leaf_edit = \
svntest.actions.deep_trees_status_local_leaf_edit
DeepTreesTestCase = svntest.actions.DeepTreesTestCase
def tree_conflicts_on_update_1_1(sbox):
"tree conflicts 1.1: tree del, leaf edit on update"
sbox.build()
expected_output = deep_trees_conflict_output.copy()
expected_output.add({
'DDF/D1/D2' : Item(status=' ', treeconflict='U'),
'DDF/D1/D2/gamma' : Item(status=' ', treeconflict='U'),
'DD/D1/D2' : Item(status=' ', treeconflict='U'),
'DD/D1/D2/epsilon' : Item(status=' ', treeconflict='A'),
'DDD/D1/D2' : Item(status=' ', treeconflict='U'),
'DDD/D1/D2/D3' : Item(status=' ', treeconflict='U'),
'DDD/D1/D2/D3/zeta' : Item(status=' ', treeconflict='A'),
'D/D1/delta' : Item(status=' ', treeconflict='A'),
'DF/D1/beta' : Item(status=' ', treeconflict='U'),
})
expected_disk = disk_empty_dirs.copy()
if svntest.main.wc_is_singledb(sbox.wc_dir):
expected_disk.remove('D/D1', 'DF/D1', 'DD/D1', 'DD/D1/D2',
'DDF/D1', 'DDF/D1/D2',
'DDD/D1', 'DDD/D1/D2', 'DDD/D1/D2/D3')
expected_status = deep_trees_status_local_tree_del.copy()
expected_status.add({
'D/D1/delta' : Item(status='D '),
'DD/D1/D2/epsilon' : Item(status='D '),
'DDD/D1/D2/D3/zeta' : Item(status='D '),
})
expected_status.tweak(wc_rev=3)
expected_info = {
'F/alpha' : {
'Tree conflict' :
'^local delete, incoming edit upon update'
+ ' Source left: .file.*/F/alpha@2'
+ ' Source right: .file.*/F/alpha@3$',
},
'DF/D1' : {
'Tree conflict' :
'^local delete, incoming edit upon update'
+ ' Source left: .dir.*/DF/D1@2'
+ ' Source right: .dir.*/DF/D1@3$',
},
'DDF/D1' : {
'Tree conflict' :
'^local delete, incoming edit upon update'
+ ' Source left: .dir.*/DDF/D1@2'
+ ' Source right: .dir.*/DDF/D1@3$',
},
'D/D1' : {
'Tree conflict' :
'^local delete, incoming edit upon update'
+ ' Source left: .dir.*/D/D1@2'
+ ' Source right: .dir.*/D/D1@3$',
},
'DD/D1' : {
'Tree conflict' :
'^local delete, incoming edit upon update'
+ ' Source left: .dir.*/DD/D1@2'
+ ' Source right: .dir.*/DD/D1@3$',
},
'DDD/D1' : {
'Tree conflict' :
'^local delete, incoming edit upon update'
+ ' Source left: .dir.*/DDD/D1@2'
+ ' Source right: .dir.*/DDD/D1@3$',
},
}
svntest.actions.deep_trees_run_tests_scheme_for_update(sbox,
[ DeepTreesTestCase("local_tree_del_incoming_leaf_edit",
tree_del,
leaf_edit,
expected_output,
expected_disk,
expected_status,
expected_info = expected_info) ] )
def tree_conflicts_on_update_1_2(sbox):
"tree conflicts 1.2: tree del, leaf del on update"
sbox.build()
expected_output = deep_trees_conflict_output.copy()
expected_output.add({
'DDD/D1/D2' : Item(status=' ', treeconflict='U'),
'DDD/D1/D2/D3' : Item(status=' ', treeconflict='D'),
'DF/D1/beta' : Item(status=' ', treeconflict='D'),
'DD/D1/D2' : Item(status=' ', treeconflict='D'),
'DDF/D1/D2' : Item(status=' ', treeconflict='U'),
'DDF/D1/D2/gamma' : Item(status=' ', treeconflict='D'),
})
expected_disk = disk_empty_dirs.copy()
expected_status = deep_trees_status_local_tree_del.copy()
expected_status.tweak(wc_rev=3)
expected_status.tweak('F/alpha',
'D/D1',
status='! ', wc_rev=None)
expected_status.remove('DD/D1/D2',
'DDD/D1/D2/D3',
'DDF/D1/D2/gamma',
'DF/D1/beta')
expected_disk.remove('D/D1',
'DD/D1/D2',
'DDD/D1/D2/D3')
if svntest.main.wc_is_singledb(sbox.wc_dir):
expected_disk.remove('DF/D1', 'DD/D1',
'DDF/D1', 'DDF/D1/D2',
'DDD/D1', 'DDD/D1/D2')
expected_info = {
'F/alpha' : {
'Tree conflict' :
'^local delete, incoming delete upon update'
+ ' Source left: .file.*/F/alpha@2'
+ ' Source right: .none.*/F/alpha@3$',
},
'DF/D1' : {
'Tree conflict' :
'^local delete, incoming edit upon update'
+ ' Source left: .dir.*/DF/D1@2'
+ ' Source right: .dir.*/DF/D1@3$',
},
'DDF/D1' : {
'Tree conflict' :
'^local delete, incoming edit upon update'
+ ' Source left: .dir.*/DDF/D1@2'
+ ' Source right: .dir.*/DDF/D1@3$',
},
'D/D1' : {
'Tree conflict' :
'^local delete, incoming delete upon update'
+ ' Source left: .dir.*/D/D1@2'
+ ' Source right: .none.*/D/D1@3$',
},
'DD/D1' : {
'Tree conflict' :
'^local delete, incoming edit upon update'
+ ' Source left: .dir.*/DD/D1@2'
+ ' Source right: .dir.*/DD/D1@3$',
},
'DDD/D1' : {
'Tree conflict' :
'^local delete, incoming edit upon update'
+ ' Source left: .dir.*/DDD/D1@2'
+ ' Source right: .dir.*/DDD/D1@3$',
},
}
svntest.actions.deep_trees_run_tests_scheme_for_update(sbox,
[ DeepTreesTestCase("local_tree_del_incoming_leaf_del",
tree_del,
leaf_del,
expected_output,
expected_disk,
expected_status,
expected_info = expected_info) ] )
def tree_conflicts_on_update_2_1(sbox):
"tree conflicts 2.1: leaf edit, tree del on update"
expected_output = deep_trees_conflict_output
expected_disk = disk_after_leaf_edit
expected_status = deep_trees_status_local_leaf_edit.copy()
expected_status.tweak(
'D/D1',
'F/alpha',
'DD/D1',
'DF/D1',
'DDD/D1',
'DDF/D1',
status='A ', copied='+', wc_rev='-')
expected_status.tweak(
'DD/D1/D2',
'DDD/D1/D2',
'DDD/D1/D2/D3',
'DF/D1/beta',
'DDF/D1/D2',
'DDF/D1/D2/gamma',
copied='+', wc_rev='-')
expected_info = {
'F/alpha' : {
'Tree conflict' :
'^local edit, incoming delete upon update'
+ ' Source left: .file.*/F/alpha@2'
+ ' Source right: .none.*/F/alpha@3$',
},
'DF/D1' : {
'Tree conflict' :
'^local edit, incoming delete upon update'
+ ' Source left: .dir.*/DF/D1@2'
+ ' Source right: .none.*/DF/D1@3$',
},
'DDF/D1' : {
'Tree conflict' :
'^local edit, incoming delete upon update'
+ ' Source left: .dir.*/DDF/D1@2'
+ ' Source right: .none.*/DDF/D1@3$',
},
'D/D1' : {
'Tree conflict' :
'^local edit, incoming delete upon update'
+ ' Source left: .dir.*/D/D1@2'
+ ' Source right: .none.*/D/D1@3$',
},
'DD/D1' : {
'Tree conflict' :
'^local edit, incoming delete upon update'
+ ' Source left: .dir.*/DD/D1@2'
+ ' Source right: .none.*/DD/D1@3$',
},
'DDD/D1' : {
'Tree conflict' :
'^local edit, incoming delete upon update'
+ ' Source left: .dir.*/DDD/D1@2'
+ ' Source right: .none.*/DDD/D1@3$',
},
}
svntest.actions.deep_trees_run_tests_scheme_for_update(sbox,
[ DeepTreesTestCase("local_leaf_edit_incoming_tree_del",
leaf_edit,
tree_del,
expected_output,
expected_disk,
expected_status,
expected_info = expected_info) ] )
def tree_conflicts_on_update_2_2(sbox):
"tree conflicts 2.2: leaf del, tree del on update"
expected_output = deep_trees_conflict_output
expected_disk = disk_empty_dirs.copy()
expected_status = svntest.actions.deep_trees_virginal_state.copy()
expected_status.add({'' : Item()})
expected_status.tweak(contents=None, status=' ', wc_rev=3)
expected_status.tweak(
'D/D1',
'F/alpha',
'DD/D1',
'DF/D1',
'DDD/D1',
'DDF/D1',
treeconflict='C', wc_rev=2)
expected_status.tweak('F/alpha',
'D/D1',
'DD/D1',
'DF/D1',
'DDD/D1',
'DDF/D1',
status='! ', wc_rev=None)
expected_status.remove('DD/D1/D2',
'DF/D1/beta',
'DDD/D1/D2',
'DDD/D1/D2/D3',
'DDF/D1/D2',
'DDF/D1/D2/gamma',)
expected_disk.remove('D/D1',
'DD/D1',
'DD/D1/D2',
'DF/D1',
'DDD/D1',
'DDD/D1/D2',
'DDD/D1/D2/D3',
'DDF/D1',
'DDF/D1/D2',)
expected_info = {
'F/alpha' : {
'Tree conflict' :
'^local delete, incoming delete upon update'
+ ' Source left: .file.*/F/alpha@2'
+ ' Source right: .none.*/F/alpha@3$',
},
'DF/D1' : {
'Tree conflict' :
'^local delete, incoming delete upon update'
+ ' Source left: .dir.*/DF/D1@2'
+ ' Source right: .none.*/DF/D1@3$',
},
'DDF/D1' : {
'Tree conflict' :
'^local delete, incoming delete upon update'
+ ' Source left: .dir.*/DDF/D1@2'
+ ' Source right: .none.*/DDF/D1@3$',
},
'D/D1' : {
'Tree conflict' :
'^local delete, incoming delete upon update'
+ ' Source left: .dir.*/D/D1@2'
+ ' Source right: .none.*/D/D1@3$',
},
'DD/D1' : {
'Tree conflict' :
'^local delete, incoming delete upon update'
+ ' Source left: .dir.*/DD/D1@2'
+ ' Source right: .none.*/DD/D1@3$',
},
'DDD/D1' : {
'Tree conflict' :
'^local delete, incoming delete upon update'
+ ' Source left: .dir.*/DDD/D1@2'
+ ' Source right: .none.*/DDD/D1@3$',
},
}
svntest.actions.deep_trees_run_tests_scheme_for_update(sbox,
[ DeepTreesTestCase("local_leaf_del_incoming_tree_del",
leaf_del,
tree_del,
expected_output,
expected_disk,
expected_status,
expected_info = expected_info) ] )
@Issue(3329)
def tree_conflicts_on_update_2_3(sbox):
"tree conflicts 2.3: skip on 2nd update"
expected_output = deep_trees_conflict_output_skipped
expected_disk = disk_after_leaf_edit
expected_status = deep_trees_status_local_leaf_edit.copy()
expected_status.tweak(
'D/D1',
'F/alpha',
'DD/D1',
'DF/D1',
'DDD/D1',
'DDF/D1',
status='A ', copied='+', wc_rev='-')
expected_status.tweak(
'DD/D1/D2',
'DDD/D1/D2',
'DDD/D1/D2/D3',
'DF/D1/beta',
'DDF/D1/D2',
'DDF/D1/D2/gamma',
copied='+', wc_rev='-')
skip_paths = [
'D/D1',
'F/alpha',
'DDD/D1',
'DDD/D1/D2/D3',
]
chdir_skip_paths = [
('D', 'D1'),
('F', 'alpha'),
('DDD', 'D1'),
('', ['D/D1', 'F/alpha', 'DD/D1', 'DF/D1', 'DDD/D1', 'DDF/D1']),
]
svntest.actions.deep_trees_skipping_on_update(sbox,
DeepTreesTestCase("local_leaf_edit_incoming_tree_del_skipping",
leaf_edit,
tree_del,
expected_output,
expected_disk,
expected_status),
skip_paths,
chdir_skip_paths)
def tree_conflicts_on_update_3(sbox):
"tree conflicts 3: tree del, tree del on update"
expected_output = deep_trees_conflict_output
expected_disk = disk_empty_dirs.copy()
expected_status = deep_trees_status_local_tree_del.copy()
expected_status.tweak('F/alpha',
'D/D1',
'DD/D1',
'DF/D1',
'DDD/D1',
'DDF/D1',
status='! ', wc_rev=None)
expected_status.remove('DD/D1/D2',
'DF/D1/beta',
'DDD/D1/D2',
'DDD/D1/D2/D3',
'DDF/D1/D2',
'DDF/D1/D2/gamma',)
expected_disk.remove('D/D1',
'DD/D1',
'DD/D1/D2',
'DF/D1',
'DDD/D1',
'DDD/D1/D2',
'DDD/D1/D2/D3',
'DDF/D1',
'DDF/D1/D2',)
expected_info = {
'F/alpha' : {
'Tree conflict' :
'^local delete, incoming delete upon update'
+ ' Source left: .file.*/F/alpha@2'
+ ' Source right: .none.*/F/alpha@3$',
},
'DF/D1' : {
'Tree conflict' :
'^local delete, incoming delete upon update'
+ ' Source left: .dir.*/DF/D1@2'
+ ' Source right: .none.*/DF/D1@3$',
},
'DDF/D1' : {
'Tree conflict' :
'^local delete, incoming delete upon update'
+ ' Source left: .dir.*/DDF/D1@2'
+ ' Source right: .none.*/DDF/D1@3$',
},
'D/D1' : {
'Tree conflict' :
'^local delete, incoming delete upon update'
+ ' Source left: .dir.*/D/D1@2'
+ ' Source right: .none.*/D/D1@3$',
},
'DD/D1' : {
'Tree conflict' :
'^local delete, incoming delete upon update'
+ ' Source left: .dir.*/DD/D1@2'
+ ' Source right: .none.*/DD/D1@3$',
},
'DDD/D1' : {
'Tree conflict' :
'^local delete, incoming delete upon update'
+ ' Source left: .dir.*/DDD/D1@2'
+ ' Source right: .none.*/DDD/D1@3$',
},
}
svntest.actions.deep_trees_run_tests_scheme_for_update(sbox,
[ DeepTreesTestCase("local_tree_del_incoming_tree_del",
tree_del,
tree_del,
expected_output,
expected_disk,
expected_status,
expected_info = expected_info) ] )
def tree_conflict_uc1_update_deleted_tree(sbox):
"tree conflicts on update UC1, update deleted tree"
sbox.build()
wc_dir = sbox.wc_dir
from svntest.actions import run_and_verify_svn, run_and_verify_resolve
from svntest.actions import run_and_verify_update, run_and_verify_commit
from svntest.verify import AnyOutput
"""A directory tree 'D1' should end up exactly the same in these two
scenarios:
New scenario:
[[[
svn checkout -r1 # in which D1 has its original state
svn delete D1
svn update -r2 # update revs & bases to r2
svn resolve --accept=mine # keep the local, deleted version
]]]
Existing scenario:
[[[
svn checkout -r2 # in which D1 is already modified
svn delete D1
]]]
"""
A = os.path.join(wc_dir, 'A')
def modify_dir(dir):
"""Make some set of local modifications to an existing tree:
A prop change, add a child, delete a child, change a child."""
run_and_verify_svn(None, AnyOutput, [], 'propset', 'p', 'v', dir)
path = os.path.join(dir, 'new_file')
svntest.main.file_write(path, "This is the file 'new_file'.\n")
svntest.actions.run_and_verify_svn(None, None, [], 'add', path)
path = os.path.join(dir, 'C', 'N')
os.mkdir(path)
path2 = os.path.join(dir, 'C', 'N', 'nu')
svntest.main.file_write(path2, "This is the file 'nu'.\n")
svntest.actions.run_and_verify_svn(None, None, [], 'add', path)
path = os.path.join(dir, 'B', 'lambda')
svntest.actions.run_and_verify_svn(None, None, [], 'delete', path)
path = os.path.join(dir, 'B', 'E', 'alpha')
svntest.main.file_append(path, "An extra line.\n")
modify_dir(A)
run_and_verify_svn(None, AnyOutput, [], 'ci', A, '-m', 'modify_dir')
run_and_verify_svn(None, AnyOutput, [], 'up', wc_dir)
wc2 = sbox.add_wc_path('wc2')
A2 = os.path.join(wc2, 'A')
svntest.actions.duplicate_dir(sbox.wc_dir, wc2)
run_and_verify_svn(None, AnyOutput, [], 'delete', A2)
run_and_verify_svn(None, AnyOutput, [], 'up', A, '-r1')
run_and_verify_svn(None, AnyOutput, [], 'delete', A)
expected_output = None
expected_disk = None
expected_status = None
run_and_verify_update(A, expected_output, expected_disk, expected_status)
run_and_verify_resolve([A], '--recursive', '--accept=working', A)
resolved_status = svntest.wc.State('', {
'' : Item(status=' ', wc_rev=2),
'A' : Item(status='D ', wc_rev=2),
'A/B' : Item(status='D ', wc_rev=2),
'A/B/E' : Item(status='D ', wc_rev=2),
'A/B/E/alpha' : Item(status='D ', wc_rev=2),
'A/B/E/beta' : Item(status='D ', wc_rev=2),
'A/B/F' : Item(status='D ', wc_rev=2),
'A/mu' : Item(status='D ', wc_rev=2),
'A/C' : Item(status='D ', wc_rev=2),
'A/C/N' : Item(status='D ', wc_rev=2),
'A/C/N/nu' : Item(status='D ', wc_rev=2),
'A/D' : Item(status='D ', wc_rev=2),
'A/D/gamma' : Item(status='D ', wc_rev=2),
'A/D/G' : Item(status='D ', wc_rev=2),
'A/D/G/pi' : Item(status='D ', wc_rev=2),
'A/D/G/rho' : Item(status='D ', wc_rev=2),
'A/D/G/tau' : Item(status='D ', wc_rev=2),
'A/D/H' : Item(status='D ', wc_rev=2),
'A/D/H/chi' : Item(status='D ', wc_rev=2),
'A/D/H/omega' : Item(status='D ', wc_rev=2),
'A/D/H/psi' : Item(status='D ', wc_rev=2),
'A/new_file' : Item(status='D ', wc_rev=2),
'iota' : Item(status=' ', wc_rev=2),
})
expected_status = resolved_status.copy()
expected_status.wc_dir = wc2
svntest.actions.run_and_verify_status(wc2, expected_status)
expected_status = resolved_status.copy()
expected_status.wc_dir = wc_dir
svntest.actions.run_and_verify_status(wc_dir, expected_status)
expected_output = svntest.wc.State(wc_dir, {
'A' : Item(verb='Deleting'),
})
expected_status = svntest.wc.State(wc_dir, {
'' : Item(status=' ', wc_rev=2),
'iota' : Item(status=' ', wc_rev=2),
})
run_and_verify_commit(wc_dir, expected_output, expected_status,
None, wc_dir, '-m', 'commit resolved tree')
@Issue(3334)
def tree_conflict_uc2_schedule_re_add(sbox):
"tree conflicts on update UC2, schedule re-add"
sbox.build()
saved_cwd = os.getcwd()
os.chdir(sbox.wc_dir)
from svntest.actions import run_and_verify_svn, run_and_verify_resolve
from svntest.actions import run_and_verify_update
from svntest.verify import AnyOutput
"""A directory tree 'D1' should end up exactly the same in these two
scenarios:
New scenario:
[[[
svn checkout -r1 # in which D1 exists
modify_d1 # make local mods in D1
svn update -r2 # tries to delete D1
svn resolve --accept=mine # keep the local, re-added version
]]]
Existing scenario:
[[[
svn checkout -r2 # in which D1 does not exist
svn copy -r1 D1 . # make a pristine copy of D1@1
modify_d1 # make local mods in D1
]]]
where modify_d1 makes property changes to D1 itself and/or
adds/deletes/modifies any of D1's children.
"""
dir = 'A' dir_url = sbox.repo_url + '/' + dir
def modify_dir(dir):
"""Make some set of local modifications to an existing tree:
A prop change, add a child, delete a child, change a child."""
run_and_verify_svn(None, AnyOutput, [],
'propset', 'p', 'v', dir)
path = os.path.join(dir, 'new_file')
svntest.main.file_write(path, "This is the file 'new_file'.\n")
svntest.actions.run_and_verify_svn(None, None, [], 'add', path)
path = os.path.join(dir, 'B', 'lambda')
svntest.actions.run_and_verify_svn(None, None, [], 'delete', path)
path = os.path.join(dir, 'B', 'E', 'alpha')
svntest.main.file_append(path, "An extra line.\n")
run_and_verify_svn(None, AnyOutput, [],
'-m', '', 'delete', dir_url)
os.chdir(saved_cwd)
wc2 = sbox.add_wc_path('wc2')
dir2 = os.path.join(wc2, dir)
svntest.actions.duplicate_dir(sbox.wc_dir, wc2)
run_and_verify_svn(None, AnyOutput, [], 'up', wc2)
run_and_verify_svn(None, AnyOutput, [], 'copy', dir_url + '@1', dir2)
modify_dir(dir2)
os.chdir(sbox.wc_dir)
modify_dir(dir)
expected_output = None
expected_disk = None
expected_status = None
run_and_verify_update('A', expected_output, expected_disk, expected_status)
run_and_verify_resolve([dir], '--recursive', '--accept=working', dir)
os.chdir(saved_cwd)
def get_status(dir):
expected_status = svntest.wc.State(dir, {
'' : Item(status=' ', wc_rev='2'),
'A' : Item(status='A ', wc_rev='-', copied='+'),
'A/B' : Item(status=' ', wc_rev='-', copied='+'),
'A/B/lambda' : Item(status='D ', wc_rev='-', copied='+'),
'A/B/E' : Item(status=' ', wc_rev='-', copied='+'),
'A/B/E/alpha' : Item(status='M ', wc_rev='-', copied='+'),
'A/B/E/beta' : Item(status=' ', wc_rev='-', copied='+'),
'A/B/F' : Item(status=' ', wc_rev='-', copied='+'),
'A/mu' : Item(status=' ', wc_rev='-', copied='+'),
'A/C' : Item(status=' ', wc_rev='-', copied='+'),
'A/D' : Item(status=' ', wc_rev='-', copied='+'),
'A/D/gamma' : Item(status=' ', wc_rev='-', copied='+'),
'A/D/G' : Item(status=' ', wc_rev='-', copied='+'),
'A/D/G/pi' : Item(status=' ', wc_rev='-', copied='+'),
'A/D/G/rho' : Item(status=' ', wc_rev='-', copied='+'),
'A/D/G/tau' : Item(status=' ', wc_rev='-', copied='+'),
'A/D/H' : Item(status=' ', wc_rev='-', copied='+'),
'A/D/H/chi' : Item(status=' ', wc_rev='-', copied='+'),
'A/D/H/omega' : Item(status=' ', wc_rev='-', copied='+'),
'A/D/H/psi' : Item(status=' ', wc_rev='-', copied='+'),
'A/new_file' : Item(status='A ', wc_rev=0),
'iota' : Item(status=' ', wc_rev=2),
})
return expected_status
expected_status = get_status(wc2)
svntest.actions.run_and_verify_status(wc2, expected_status)
expected_status = get_status(sbox.wc_dir)
expected_status.tweak('', 'iota', wc_rev=1)
svntest.actions.run_and_verify_status(sbox.wc_dir, expected_status)
def set_deep_depth_on_target_with_shallow_children(sbox):
"infinite --set-depth adds shallow children"
sbox.build()
wc_dir = sbox.wc_dir
A_path = os.path.join(wc_dir, "A")
B_path = os.path.join(wc_dir, "A", "B")
D_path = os.path.join(wc_dir, "A", "D")
expected_output = svntest.wc.State(wc_dir, {
'A/B/E' : Item(status='D '),
'A/B/lambda' : Item(status='D '),
'A/B/F' : Item(status='D '),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.remove('A/B/F',
'A/B/lambda',
'A/B/E',
'A/B/E/alpha',
'A/B/E/beta')
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.remove('A/B/F',
'A/B/lambda',
'A/B/E',
'A/B/E/alpha',
'A/B/E/beta')
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status,
None, None, None,
None, None, 1,
'--set-depth', 'empty',
B_path)
expected_output = svntest.wc.State(wc_dir, {
'A/D/G/pi' : Item(status='D '),
'A/D/G/rho' : Item(status='D '),
'A/D/G/tau' : Item(status='D '),
'A/D/H/chi' : Item(status='D '),
'A/D/H/omega' : Item(status='D '),
'A/D/H/psi' : Item(status='D '),
})
expected_status.remove('A/D/G/pi',
'A/D/G/rho',
'A/D/G/tau',
'A/D/H/chi',
'A/D/H/omega',
'A/D/H/psi')
expected_disk.remove('A/D/G/pi',
'A/D/G/rho',
'A/D/G/tau',
'A/D/H/chi',
'A/D/H/omega',
'A/D/H/psi')
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status,
None, None, None,
None, None, 1,
'--set-depth', 'immediates',
D_path)
expected_output = svntest.wc.State(wc_dir, {
'A/B/lambda' : Item(status='A '),
'A/B/F' : Item(status='A '),
'A/B/E' : Item(status='A '),
'A/B/E/alpha' : Item(status='A '),
'A/B/E/beta' : Item(status='A '),
'A/D/G/pi' : Item(status='A '),
'A/D/G/rho' : Item(status='A '),
'A/D/G/tau' : Item(status='A '),
'A/D/H/chi' : Item(status='A '),
'A/D/H/omega' : Item(status='A '),
'A/D/H/psi' : Item(status='A '),
})
expected_disk = svntest.main.greek_state.copy()
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, 1,
'--set-depth', 'infinity',
A_path)
def update_wc_of_dir_to_rev_not_containing_this_dir(sbox):
"update wc of dir to rev not containing this dir"
sbox.build()
A_url = sbox.repo_url + "/A"
other_wc_dir = sbox.add_wc_path("other")
svntest.actions.run_and_verify_svn(None, None, [], "co", A_url, other_wc_dir)
svntest.actions.run_and_verify_svn(None, None, [], "rm", A_url, "-m", "")
svntest.actions.run_and_verify_svn(None, None,
"svn: E160005: Target path '/A' does not exist",
"up", other_wc_dir)
@Issue(3569)
def update_empty_hides_entries(sbox):
"svn up --depth empty hides entries for next update"
sbox.build()
wc_dir = sbox.wc_dir
expected_disk_empty = []
expected_status_empty = []
expected_disk = svntest.main.greek_state.copy()
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
svntest.actions.run_and_verify_update(wc_dir,
None,
expected_disk_empty,
expected_status_empty,
None, None, None,
None, None, 1,
'-r', '0',
wc_dir)
svntest.actions.run_and_verify_update(wc_dir,
None,
expected_disk,
expected_status,
None, None, None,
None, None, 1,
wc_dir)
svntest.actions.run_and_verify_update(wc_dir,
None,
expected_disk_empty,
expected_status_empty,
None, None, None,
None, None, 1,
'-r', '0',
wc_dir)
svntest.actions.run_and_verify_update(wc_dir,
None,
expected_disk_empty,
expected_status_empty,
None, None, None,
None, None, 1,
'--depth', 'empty',
wc_dir)
svntest.actions.run_and_verify_update(wc_dir,
None,
expected_disk,
expected_status,
None, None, None,
None, None, 1,
wc_dir)
def mergeinfo_updates_merge_with_local_mods(sbox):
"local mergeinfo changes are merged with updates"
sbox.build()
wc_dir = sbox.wc_dir
expected_disk, expected_status = set_up_branch(sbox)
A_path = os.path.join(wc_dir, "A")
A_COPY_path = os.path.join(wc_dir, "A_COPY")
svntest.actions.run_and_verify_svn(None, None, [], 'up', wc_dir)
svntest.actions.run_and_verify_svn(None, None, [],
'merge', '-c3', '--depth', 'empty',
sbox.repo_url + '/A', A_COPY_path)
svntest.actions.run_and_verify_svn(None, None, [], 'ci', '-m',
'Merge r3 from A to A_COPY at depth empty',
wc_dir)
svntest.actions.run_and_verify_svn(None, None, [], 'up', wc_dir)
svntest.actions.run_and_verify_svn(None, None, [],
'merge', '-c5',
sbox.repo_url + '/A', A_COPY_path)
svntest.actions.run_and_verify_svn(None, None, [], 'ci', '-m',
'Merge r5 from A to A_COPY', wc_dir)
svntest.actions.run_and_verify_svn(None, None, [], 'up', '-r7', wc_dir)
svntest.actions.run_and_verify_svn(None, None, [],
'merge', '-c3', '--depth', 'infinity',
sbox.repo_url + '/A', A_COPY_path)
svntest.actions.run_and_verify_svn(None, [A_COPY_path + " - /A:3\n"], [],
'pg', SVN_PROP_MERGEINFO, '-R',
A_COPY_path)
svntest.actions.run_and_verify_svn(None, None, [], 'up', wc_dir)
svntest.actions.run_and_verify_svn(None, [A_COPY_path + " - /A:3,5\n"], [],
'pg', SVN_PROP_MERGEINFO, '-R',
A_COPY_path)
def update_with_excluded_subdir(sbox):
"""update with an excluded subdir"""
sbox.build()
wc_dir = sbox.wc_dir
G = os.path.join(os.path.join(wc_dir, 'A', 'D', 'G'))
expected_output = svntest.wc.State(wc_dir, {
'A/D/G' : Item(status='D '),
})
expected_disk = svntest.main.greek_state.copy()
expected_disk.remove('A/D/G', 'A/D/G/pi', 'A/D/G/rho', 'A/D/G/tau')
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.remove('A/D/G', 'A/D/G/pi', 'A/D/G/rho', 'A/D/G/tau')
svntest.actions.run_and_verify_update(wc_dir, expected_output,
expected_disk, expected_status,
None, None, None, None, None, False,
'--set-depth=exclude', G)
svntest.main.run_svn(None, 'mkdir', '-m', '', sbox.repo_url + '/New')
expected_output = svntest.wc.State(wc_dir, {
'New' : Item(status='A ') })
expected_disk.add({
'New' : Item() })
expected_status.add({
'New' : Item(status=' ') })
expected_status.tweak(wc_rev=2)
svntest.actions.run_and_verify_update(wc_dir, expected_output,
expected_disk, expected_status)
@Issue(3471)
def update_with_file_lock_and_keywords_property_set(sbox):
"""update with file lock & keywords property set"""
sbox.build()
wc_dir = sbox.wc_dir
mu_path = os.path.join(wc_dir, 'A', 'mu')
svntest.main.file_append(mu_path, '$Id$')
svntest.main.run_svn(None, 'ps', 'svn:keywords', 'Id', mu_path)
svntest.main.run_svn(None, 'lock', mu_path)
mu_ts_before_update = os.path.getmtime(mu_path)
time.sleep(1.1)
sbox.simple_update()
mu_ts_after_update = os.path.getmtime(mu_path)
if (mu_ts_before_update != mu_ts_after_update):
print("The timestamp of 'mu' before and after update does not match.")
raise svntest.Failure
@Issue(3807)
def update_nonexistent_child_of_copy(sbox):
"""update a nonexistent child of a copied dir"""
sbox.build()
os.chdir(sbox.wc_dir)
svntest.main.run_svn(None, 'copy', 'A', 'A2')
expected_output = svntest.wc.State('A2', {
'nonexistent' : Item(verb='Skipped'),
})
svntest.actions.run_and_verify_update(os.path.join('A2', 'nonexistent'),
expected_output, None, None, None)
svntest.main.run_svn(None, 'delete', os.path.join('A2', 'mu'))
expected_output = svntest.wc.State('A2', {
'mu' : Item(verb='Skipped'),
})
svntest.actions.run_and_verify_update(os.path.join('A2', 'mu'),
expected_output, None, None, None)
if os.path.exists('A2/mu'):
raise svntest.Failure("A2/mu improperly revived")
@Issue(3807)
def revive_children_of_copy(sbox):
"""undelete a child of a copied dir"""
sbox.build()
os.chdir(sbox.wc_dir)
chi2_path = os.path.join('A2/D/H/chi')
psi2_path = os.path.join('A2/D/H/psi')
svntest.main.run_svn(None, 'copy', 'A', 'A2')
svntest.main.run_svn(None, 'rm', chi2_path)
os.unlink(psi2_path)
svntest.main.run_svn(None, 'revert', chi2_path, psi2_path)
if not os.path.exists(chi2_path):
raise svntest.Failure('chi unexpectedly non-existent')
if not os.path.exists(psi2_path):
raise svntest.Failure('psi unexpectedly non-existent')
@SkipUnless(svntest.main.is_os_windows)
def skip_access_denied(sbox):
"""access denied paths should be skipped"""
try:
import msvcrt
except ImportError:
raise svntest.Skip
sbox.build()
wc_dir = sbox.wc_dir
iota = sbox.ospath('iota')
svntest.main.file_write(iota, 'Q')
sbox.simple_commit()
sbox.simple_update()
f = open(iota, 'w')
f.write('R')
f.flush()
msvcrt.locking(f.fileno(), 1, 1)
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(verb='Skipped'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('iota', status='M ', wc_rev=2)
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
None,
expected_status,
None,
None, None,
None, None, None, wc_dir, '-r', '1')
f.close()
def update_to_HEAD_plus_1(sbox):
"updating to HEAD+1 should fail"
sbox.build(read_only = True)
wc_dir = sbox.wc_dir
svntest.actions.run_and_verify_update(wc_dir,
None, None, None,
"E160006.*No such.*revision",
None, None,
None, None, None, wc_dir, '-r', '2')
test_list = [ None,
update_binary_file,
update_binary_file_2,
update_ignores_added,
update_to_rev_zero,
receive_overlapping_same_change,
update_to_resolve_text_conflicts,
update_delete_modified_files,
update_after_add_rm_deleted,
update_missing,
update_replace_dir,
update_single_file,
prop_update_on_scheduled_delete,
update_receive_illegal_name,
update_deleted_missing_dir,
another_hudson_problem,
update_deleted_targets,
new_dir_with_spaces,
non_recursive_update,
checkout_empty_dir,
update_to_deletion,
update_deletion_inside_out,
update_schedule_add_dir,
update_to_future_add,
nested_in_read_only,
obstructed_update_alters_wc_props,
update_xml_unsafe_dir,
conflict_markers_matching_eol,
update_eolstyle_handling,
update_copy_of_old_rev,
forced_update,
forced_update_failures,
update_wc_on_windows_drive,
update_wc_with_replaced_file,
update_with_obstructing_additions,
update_conflicted,
mergeinfo_update_elision,
update_copied_from_replaced_and_changed,
update_copied_and_deleted_prop,
update_accept_conflicts,
eof_in_interactive_conflict_resolver,
update_uuid_changed,
restarted_update_should_delete_dir_prop,
tree_conflicts_on_update_1_1,
tree_conflicts_on_update_1_2,
tree_conflicts_on_update_2_1,
tree_conflicts_on_update_2_2,
tree_conflicts_on_update_2_3,
tree_conflicts_on_update_3,
tree_conflict_uc1_update_deleted_tree,
tree_conflict_uc2_schedule_re_add,
set_deep_depth_on_target_with_shallow_children,
update_wc_of_dir_to_rev_not_containing_this_dir,
update_empty_hides_entries,
mergeinfo_updates_merge_with_local_mods,
update_with_excluded_subdir,
update_with_file_lock_and_keywords_property_set,
update_nonexistent_child_of_copy,
revive_children_of_copy,
skip_access_denied,
update_to_HEAD_plus_1,
]
if __name__ == '__main__':
svntest.main.run_tests(test_list)