summaryrefslogtreecommitdiff
path: root/subversion/tests/cmdline/depth_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'subversion/tests/cmdline/depth_tests.py')
-rwxr-xr-xsubversion/tests/cmdline/depth_tests.py152
1 files changed, 78 insertions, 74 deletions
diff --git a/subversion/tests/cmdline/depth_tests.py b/subversion/tests/cmdline/depth_tests.py
index e0e7057..18af743 100755
--- a/subversion/tests/cmdline/depth_tests.py
+++ b/subversion/tests/cmdline/depth_tests.py
@@ -106,7 +106,7 @@ def verify_depth(msg, depth, path="."):
[], "info", path)
for line in out:
if line.startswith("Depth:"):
- raise svntest.failure(msg)
+ raise svntest.Failure(msg)
else:
expected_stdout = svntest.verify.ExpectedOutput("Depth: %s\n" % depth,
match_all=False)
@@ -151,10 +151,10 @@ def depth_files_same_as_nonrecursive(sbox, opt):
# Should create a depth-files top directory, so both iota and A
# should exist, and A should be empty and depth-empty.
- if not os.path.exists(os.path.join(sbox.wc_dir, "iota")):
+ if not os.path.exists(sbox.ospath('iota')):
raise svntest.Failure("'checkout %s' failed to create file 'iota'" % opt)
- if os.path.exists(os.path.join(sbox.wc_dir, "A")):
+ if os.path.exists(sbox.ospath('A')):
raise svntest.Failure("'checkout %s' unexpectedly created subdir 'A'" % opt)
verify_depth("Expected depth files for top of WC, got some other depth",
@@ -826,7 +826,7 @@ def depth_immediates_subdir_propset_2(sbox):
other_wc = sbox.add_wc_path('other')
svntest.actions.duplicate_dir(wc_dir, other_wc)
- A_path = os.path.join(wc_dir, 'A')
+ A_path = sbox.ospath('A')
# Set a property on an immediate subdirectory of the working copy.
svntest.actions.run_and_verify_svn(None, None, [],
@@ -959,8 +959,8 @@ def commit_propmods_with_depth_empty_helper(sbox, depth_arg):
sbox.build()
wc_dir = sbox.wc_dir
- iota_path = os.path.join(wc_dir, 'iota')
- A_path = os.path.join(wc_dir, 'A')
+ iota_path = sbox.ospath('iota')
+ A_path = sbox.ospath('A')
D_path = os.path.join(A_path, 'D')
gamma_path = os.path.join(D_path, 'gamma')
G_path = os.path.join(D_path, 'G')
@@ -1042,46 +1042,26 @@ def diff_in_depthy_wc(sbox):
svntest.actions.run_and_verify_svn(None, None, [],
'commit', '-m', '', wc)
- diff = [
- "Index: A/mu\n",
- "===================================================================\n",
- "--- A/mu\t(revision 2)\n",
- "+++ A/mu\t(working copy)\n",
+ from diff_tests import make_diff_header, make_diff_prop_header
+ from diff_tests import make_diff_prop_deleted, make_diff_prop_added
+ diff_mu = make_diff_header('A/mu', 'revision 2', 'working copy') + [
"@@ -1 +1 @@\n",
"-new text\n",
- "+This is the file 'mu'.\n",
- "Index: A\n",
- "===================================================================\n",
- "--- A\t(revision 2)\n",
- "+++ A\t(working copy)\n",
- "\n",
- "Property changes on: A\n",
- "___________________________________________________________________\n",
- "Deleted: bar\n",
- "## -1 +0,0 ##\n",
- "-bar-val\n",
- "Index: iota\n",
- "===================================================================\n",
- "--- iota\t(revision 2)\n",
- "+++ iota\t(working copy)\n",
+ "+This is the file 'mu'.\n"]
+ diff_A = make_diff_header('A', 'revision 2', 'working copy') + \
+ make_diff_prop_header('A') + \
+ make_diff_prop_deleted('bar', 'bar-val')
+ diff_iota = make_diff_header('iota', 'revision 2', 'working copy') + [
"@@ -1 +1 @@\n",
"-new text\n",
- "+This is the file 'iota'.\n",
- "Index: .\n",
- "===================================================================\n",
- "--- .\t(revision 2)\n",
- "+++ .\t(working copy)\n",
- "\n",
- "Property changes on: .\n",
- "___________________________________________________________________\n",
- "Deleted: foo\n",
- "## -1 +0,0 ##\n",
- "-foo-val\n",
- "\\ No newline at end of property\n"]
+ "+This is the file 'iota'.\n"]
+ diff_dot = make_diff_header('.', 'revision 2', 'working copy') + \
+ make_diff_prop_header('.') + \
+ make_diff_prop_deleted('foo', 'foo-val')
os.chdir(wc_empty)
- expected_output = svntest.verify.UnorderedOutput(diff[24:])
+ expected_output = svntest.verify.UnorderedOutput(diff_dot)
# The diff should contain only the propchange on '.'
svntest.actions.run_and_verify_svn(None, expected_output, [],
'diff', '-rHEAD')
@@ -1091,11 +1071,11 @@ def diff_in_depthy_wc(sbox):
'--set-depth', 'files', '-r1')
# The diff should contain only the propchange on '.' and the
# contents change on iota.
- expected_output = svntest.verify.UnorderedOutput(diff[17:])
+ expected_output = svntest.verify.UnorderedOutput(diff_iota + diff_dot)
svntest.actions.run_and_verify_svn(None, expected_output, [],
'diff', '-rHEAD')
# Do a diff at --depth empty.
- expected_output = svntest.verify.UnorderedOutput(diff[24:])
+ expected_output = svntest.verify.UnorderedOutput(diff_dot)
svntest.actions.run_and_verify_svn(None, expected_output, [],
'diff', '--depth', 'empty', '-rHEAD')
@@ -1104,11 +1084,12 @@ def diff_in_depthy_wc(sbox):
'--set-depth', 'immediates', '-r1')
# The diff should contain the propchanges on '.' and 'A' and the
# contents change on iota.
- expected_output = svntest.verify.UnorderedOutput(diff[7:])
+ expected_output = svntest.verify.UnorderedOutput(diff_A + diff_iota +
+ diff_dot)
svntest.actions.run_and_verify_svn(None, expected_output, [],
'diff', '-rHEAD')
# Do a diff at --depth files.
- expected_output = svntest.verify.UnorderedOutput(diff[17:])
+ expected_output = svntest.verify.UnorderedOutput(diff_iota + diff_dot)
svntest.actions.run_and_verify_svn(None, expected_output, [],
'diff', '--depth', 'files', '-rHEAD')
@@ -1117,11 +1098,12 @@ def diff_in_depthy_wc(sbox):
'--set-depth', 'files', '-r1', 'A')
# The diff should contain everything but the contents change on
# gamma (which does not exist in this working copy).
- expected_output = svntest.verify.UnorderedOutput(diff)
+ expected_output = svntest.verify.UnorderedOutput(diff_mu + diff_A +
+ diff_iota + diff_dot)
svntest.actions.run_and_verify_svn(None, expected_output, [],
'diff', '-rHEAD')
# Do a diff at --depth immediates.
- expected_output = svntest.verify.UnorderedOutput(diff[7:])
+ expected_output = svntest.verify.UnorderedOutput(diff_A + diff_iota + diff_dot)
svntest.actions.run_and_verify_svn(None, expected_output, [],
'diff', '--depth', 'immediates', '-rHEAD')
@@ -1171,9 +1153,9 @@ def commit_depth_immediates(sbox):
# Transmitting file data ..
# Committed revision 2.
- iota_path = os.path.join(wc_dir, 'iota')
- mu_path = os.path.join(wc_dir, 'A', 'mu')
- G_path = os.path.join(wc_dir, 'A', 'D', 'G')
+ iota_path = sbox.ospath('iota')
+ mu_path = sbox.ospath('A/mu')
+ G_path = sbox.ospath('A/D/G')
rho_path = os.path.join(G_path, 'rho')
svntest.main.file_append(iota_path, "new text in iota\n")
@@ -1254,7 +1236,7 @@ def add_tree_with_depth(sbox):
"add multi-subdir tree with --depth options" # For issue #2931
sbox.build()
wc_dir = sbox.wc_dir
- new1_path = os.path.join(wc_dir, 'new1')
+ new1_path = sbox.ospath('new1')
new2_path = os.path.join(new1_path, 'new2')
new3_path = os.path.join(new2_path, 'new3')
new4_path = os.path.join(new3_path, 'new4')
@@ -1512,7 +1494,7 @@ def depth_folding_clean_trees_1(sbox):
ign_a, ign_b, ign_c, wc_dir = set_up_depthy_working_copies(sbox,
infinity=True)
- A_path = os.path.join(wc_dir, 'A')
+ A_path = sbox.ospath('A')
C_path = os.path.join(A_path, 'C')
B_path = os.path.join(A_path, 'B')
D_path = os.path.join(A_path, 'D')
@@ -1979,7 +1961,7 @@ def fold_tree_with_unversioned_modified_items(sbox):
ign_a, ign_b, ign_c, wc_dir = set_up_depthy_working_copies(sbox,
infinity=True)
- A_path = os.path.join(wc_dir, 'A')
+ A_path = sbox.ospath('A')
pi_path = os.path.join(A_path, 'D', 'G', 'pi')
mu_path = os.path.join(A_path, 'mu')
unv_path = os.path.join(A_path, 'B', 'unv')
@@ -2035,7 +2017,7 @@ def depth_empty_update_on_file(sbox):
sbox.build()
wc_dir = sbox.wc_dir
- iota_path = os.path.join(wc_dir, 'iota')
+ iota_path = sbox.ospath('iota')
# Change iota and commit it in r2.
svntest.main.file_write(iota_path, 'Modified iota\n')
@@ -2073,20 +2055,20 @@ def excluded_path_update_operation(sbox):
ign_a, ign_b, ign_c, wc_dir = set_up_depthy_working_copies(sbox,
infinity=True)
- A_path = os.path.join(wc_dir, 'A')
+ A_path = sbox.ospath('A')
B_path = os.path.join(A_path, 'B')
L_path = os.path.join(A_path, 'L')
E_path = os.path.join(B_path, 'E')
- iota_path = os.path.join(wc_dir, 'iota')
+ iota_path = sbox.ospath('iota')
# Simply exclude a subtree
expected_output = svntest.wc.State(wc_dir, {
'A/B/E' : Item(status='D '),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
- expected_status.remove('A/B/E/alpha', 'A/B/E/beta', 'A/B/E');
+ expected_status.remove('A/B/E/alpha', 'A/B/E/beta', 'A/B/E')
expected_disk = svntest.main.greek_state.copy()
- expected_disk.remove('A/B/E/alpha', 'A/B/E/beta', 'A/B/E');
+ expected_disk.remove('A/B/E/alpha', 'A/B/E/beta', 'A/B/E')
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
@@ -2124,8 +2106,8 @@ def excluded_path_update_operation(sbox):
expected_output = svntest.wc.State(wc_dir, {
'A/B' : Item(status='D '),
})
- expected_status.remove('A/B/F', 'A/B/E', 'A/B/lambda', 'A/B');
- expected_disk.remove('A/B/F', 'A/B/E', 'A/B/lambda', 'A/B');
+ expected_status.remove('A/B/F', 'A/B/E', 'A/B/lambda', 'A/B')
+ expected_disk.remove('A/B/F', 'A/B/E', 'A/B/lambda', 'A/B')
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
@@ -2158,8 +2140,8 @@ def excluded_path_update_operation(sbox):
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(status='D '),
})
- expected_status.remove('iota');
- expected_disk.remove('iota');
+ expected_status.remove('iota')
+ expected_disk.remove('iota')
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
@@ -2190,7 +2172,7 @@ def excluded_path_misc_operation(sbox):
ign_a, ign_b, ign_c, wc_dir = set_up_depthy_working_copies(sbox,
infinity=True)
- A_path = os.path.join(wc_dir, 'A')
+ A_path = sbox.ospath('A')
B_path = os.path.join(A_path, 'B')
L_path = os.path.join(A_path, 'L')
M_path = os.path.join(A_path, 'M')
@@ -2202,9 +2184,9 @@ def excluded_path_misc_operation(sbox):
'A/B/E' : Item(status='D '),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
- expected_status.remove('A/B/E/alpha', 'A/B/E/beta', 'A/B/E');
+ expected_status.remove('A/B/E/alpha', 'A/B/E/beta', 'A/B/E')
expected_disk = svntest.main.greek_state.copy()
- expected_disk.remove('A/B/E/alpha', 'A/B/E/beta', 'A/B/E');
+ expected_disk.remove('A/B/E/alpha', 'A/B/E/beta', 'A/B/E')
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
@@ -2336,7 +2318,7 @@ def exclude_keeps_hidden_entries(sbox):
sbox.build()
wc_dir = sbox.wc_dir
- A_path = os.path.join(wc_dir, 'A')
+ A_path = sbox.ospath('A')
os.chdir(A_path)
# the second 'up' used to cause the entry of 'C' to be lost.
@@ -2370,7 +2352,7 @@ def info_excluded(sbox):
sbox.build()
wc_dir = sbox.wc_dir
- A_path = os.path.join(wc_dir, 'A')
+ A_path = sbox.ospath('A')
svntest.main.run_svn(None, 'up', '--set-depth', 'exclude', A_path)
expected_info = {
@@ -2452,9 +2434,8 @@ def make_depth_tree_conflicts(sbox):
expected_disk = svntest.main.greek_state.copy()
expected_disk.remove('A/mu',
'A/B', 'A/B/lambda', 'A/B/E/alpha', 'A/B/E/beta',
- 'A/D/gamma');
- if svntest.main.wc_is_singledb(sbox.wc_dir):
- expected_disk.remove('A/B/E', 'A/B/F')
+ 'A/D/gamma',
+ 'A/B/E', 'A/B/F')
# This test is set XFail because this (correct) status cannot be
# verified due to an "svn update" bug. The tree-conflict on A/B
@@ -2539,7 +2520,7 @@ def update_excluded_path_sticky_depths(sbox):
ign_a, ign_b, ign_c, wc_dir = set_up_depthy_working_copies(sbox,
infinity=True)
- A_path = os.path.join(wc_dir, 'A')
+ A_path = sbox.ospath('A')
B_path = os.path.join(A_path, 'B')
# Exclude the subtree 'A/B'
@@ -2734,9 +2715,9 @@ def sparse_update_with_dash_dash_parents(sbox):
sbox.build(create_wc = False)
sbox.add_test_path(sbox.wc_dir, True)
- alpha_path = os.path.join(sbox.wc_dir, 'A', 'B', 'E', 'alpha')
- pi_path = os.path.join(sbox.wc_dir, 'A', 'D', 'G', 'pi')
- omega_path = os.path.join(sbox.wc_dir, 'A', 'D', 'H', 'omega')
+ alpha_path = sbox.ospath('A/B/E/alpha')
+ pi_path = sbox.ospath('A/D/G/pi')
+ omega_path = sbox.ospath('A/D/H/omega')
# Start with a depth=empty root checkout.
svntest.actions.run_and_verify_svn(
@@ -2886,9 +2867,9 @@ def revert_depth_files(sbox):
"depth immediate+files should revert deleted files"
sbox.build(read_only = True)
-
+
expected_output = "Reverted '" + re.escape(sbox.ospath('A/mu')) + "'"
-
+
# Apply an unrelated delete one level to deep
sbox.simple_rm('A/D/gamma')
@@ -2905,6 +2886,28 @@ def revert_depth_files(sbox):
svntest.actions.run_and_verify_svn(None, expected_output, [],
'revert', '--depth=files', sbox.ospath('A'))
+@Issue(4257)
+def spurious_nodes_row(sbox):
+ "update produces no spurious rows"
+
+ sbox.build(read_only = True)
+ return
+
+ val1 = svntest.wc.sqlite_stmt(sbox.wc_dir, "select count(*) from nodes")
+ expected_output = svntest.wc.State(sbox.wc_dir, { })
+ expected_disk = svntest.main.greek_state.copy()
+ expected_status = svntest.actions.get_virginal_state(sbox.wc_dir, 1)
+ svntest.actions.run_and_verify_update(sbox.wc_dir,
+ expected_output,
+ expected_disk,
+ expected_status,
+ None, None, None, None, None, False,
+ "--depth=empty", sbox.wc_dir)
+ val2 = svntest.wc.sqlite_stmt(sbox.wc_dir, "select count(*) from nodes")
+ if (val1 != val2):
+ # ra_neon added a spurious not-present row that does not show up in status
+ raise svntest.Failure("count changed from '%s' to '%s'" % (val1, val2))
+
#----------------------------------------------------------------------
# list all tests here, starting with None:
@@ -2955,6 +2958,7 @@ test_list = [ None,
update_below_depth_empty,
commit_then_immediates_update,
revert_depth_files,
+ spurious_nodes_row,
]
if __name__ == "__main__":