Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/tests/cmdline/import_tests.py view on Meta::CPAN
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
######################################################################
# General modules
import re, os.path, sys
# Our testing module
import svntest
from svntest import wc
from prop_tests import create_inherited_ignores_config
from svntest.main import SVN_PROP_INHERITABLE_IGNORES
# (abbreviation)
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 = wc.StateItem
exp_noop_up_out = svntest.actions.expected_noop_update_output
######################################################################
# Tests
#
# Each test must return on success or raise on failure.
#----------------------------------------------------------------------
# this test should be SKIPped on systems without the executable bit
@SkipUnless(svntest.main.is_posix_os)
def import_executable(sbox):
"import of executable files"
sbox.build()
wc_dir = sbox.wc_dir
# create a new directory with files of various permissions
xt_path = os.path.join(wc_dir, "XT")
os.makedirs(xt_path)
all_path = os.path.join(wc_dir, "XT/all_exe")
none_path = os.path.join(wc_dir, "XT/none_exe")
user_path = os.path.join(wc_dir, "XT/user_exe")
group_path = os.path.join(wc_dir, "XT/group_exe")
other_path = os.path.join(wc_dir, "XT/other_exe")
for path in [all_path, none_path, user_path, group_path, other_path]:
svntest.main.file_append(path, "some text")
# set executable bits
os.chmod(all_path, 0777)
os.chmod(none_path, 0666)
os.chmod(user_path, 0766)
os.chmod(group_path, 0676)
os.chmod(other_path, 0667)
# import new files into repository
url = sbox.repo_url
exit_code, output, errput = svntest.actions.run_and_verify_svn(
None, None, [], 'import',
'-m', 'Log message for new import', xt_path, url)
lastline = output.pop().strip()
cm = re.compile ("(Committed|Imported) revision [0-9]+.")
match = cm.search (lastline)
if not match:
### we should raise a less generic error here. which?
raise svntest.Failure
# remove (uncontrolled) local files
svntest.main.safe_rmtree(xt_path)
# Create expected disk tree for the update (disregarding props)
expected_disk = svntest.main.greek_state.copy()
expected_disk.add({
'all_exe' : Item('some text', props={'svn:executable' : ''}),
'none_exe' : Item('some text'),
'user_exe' : Item('some text', props={'svn:executable' : ''}),
'group_exe' : Item('some text'),
'other_exe' : Item('some text'),
})
# Create expected status tree for the update (disregarding props).
# Newly imported file should be at revision 2.
expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
expected_status.add({
'all_exe' : Item(status=' ', wc_rev=2),
'none_exe' : Item(status=' ', wc_rev=2),
'user_exe' : Item(status=' ', wc_rev=2),
'group_exe' : Item(status=' ', wc_rev=2),
'other_exe' : Item(status=' ', wc_rev=2),
})
# Create expected output tree for the update.
expected_output = svntest.wc.State(wc_dir, {
'all_exe' : Item(status='A '),
'none_exe' : Item(status='A '),
'user_exe' : Item(status='A '),
'group_exe' : Item(status='A '),
'other_exe' : Item(status='A '),
})
# do update and check three ways
svntest.actions.run_and_verify_update(wc_dir,
expected_output,
expected_disk,
expected_status,
None, None, None,
None, None, 1)
#----------------------------------------------------------------------
def import_ignores(sbox):
'do not import ignored files in imported dirs'
# The bug was that
#
( run in 1.351 second using v1.01-cache-2.11-cpan-9288abcf80b )