Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/tests/cmdline/commit_tests.py view on Meta::CPAN
fp.write("%s\\n")
fp.close()"""
# Setup the hook configs to log data to a file
start_commit_hook = svntest.main.get_start_commit_hook_path(repo_dir)
svntest.main.create_python_hook_script(start_commit_hook,
hook_format % "start_commit_hook")
pre_commit_hook = svntest.main.get_pre_commit_hook_path(repo_dir)
svntest.main.create_python_hook_script(pre_commit_hook,
hook_format % "pre_commit_hook")
post_commit_hook = svntest.main.get_post_commit_hook_path(repo_dir)
svntest.main.create_python_hook_script(post_commit_hook,
hook_format % "post_commit_hook")
# Modify iota just so there is something to commit.
iota_path = sbox.ospath('iota')
svntest.main.file_append(iota_path, "More stuff in iota")
# Commit, no output expected.
svntest.actions.run_and_verify_svn(None, [], [],
'ci', '--quiet',
'-m', 'log msg', wc_dir)
# Now check the logfile
expected_data = [ 'start_commit_hook\n', 'pre_commit_hook\n', 'post_commit_hook\n' ]
logfilename = os.path.join(repo_dir, "hooks.log")
if os.path.exists(logfilename):
fp = open(logfilename)
else:
raise svntest.verify.SVNUnexpectedOutput("hook logfile %s not found")\
% logfilename
actual_data = fp.readlines()
fp.close()
os.unlink(logfilename)
svntest.verify.compare_and_display_lines('wrong hook logfile content',
'STDERR',
expected_data, actual_data)
#----------------------------------------------------------------------
# Regression test for bug #469, whereby merge() was once reporting
# erroneous conflicts due to Ancestor < Target < Source, in terms of
# node-rev-id parentage.
def merge_mixed_revisions(sbox):
"commit mixed-rev wc (no erroneous merge error)"
sbox.build()
wc_dir = sbox.wc_dir
# Make some convenient paths.
iota_path = sbox.ospath('iota')
H_path = sbox.ospath('A/D/H')
chi_path = sbox.ospath('A/D/H/chi')
omega_path = sbox.ospath('A/D/H/omega')
# Here's the reproduction formula, in 5 parts.
# Hoo, what a buildup of state!
# 1. echo "moo" >> iota; echo "moo" >> A/D/H/chi; svn ci
svntest.main.file_append(iota_path, "moo")
svntest.main.file_append(chi_path, "moo")
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(verb='Sending'),
'A/D/H/chi' : Item(verb='Sending'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('iota', 'A/D/H/chi', wc_rev=2)
svntest.actions.run_and_verify_commit(wc_dir,
expected_output,
expected_status,
None, wc_dir)
# 2. svn up A/D/H
expected_status = svntest.wc.State(wc_dir, {
'A/D/H' : Item(status=' ', wc_rev=2),
'A/D/H/chi' : Item(status=' ', wc_rev=2),
'A/D/H/omega' : Item(status=' ', wc_rev=2),
'A/D/H/psi' : Item(status=' ', wc_rev=2),
})
expected_disk = svntest.wc.State('', {
'omega' : Item("This is the file 'omega'.\n"),
'chi' : Item("This is the file 'chi'.\nmoo"),
'psi' : Item("This is the file 'psi'.\n"),
})
expected_output = svntest.wc.State(wc_dir, { })
svntest.actions.run_and_verify_update(H_path,
expected_output,
expected_disk,
expected_status)
# 3. echo "moo" >> iota; svn ci iota
svntest.main.file_append(iota_path, "moo2")
expected_output = svntest.wc.State(wc_dir, {
'iota' : Item(verb='Sending'),
})
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('A/D/H', 'A/D/H/omega', 'A/D/H/chi', 'A/D/H/psi',
wc_rev=2)
expected_status.tweak('iota', wc_rev=3)
svntest.actions.run_and_verify_commit(wc_dir,
expected_output,
expected_status,
None, wc_dir)
# 4. echo "moo" >> A/D/H/chi; svn ci A/D/H/chi
svntest.main.file_append(chi_path, "moo3")
expected_output = svntest.wc.State(wc_dir, {
'A/D/H/chi' : Item(verb='Sending'),
})
( run in 2.386 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )