Alien-SVN

 view release on metacpan or  search on metacpan

src/subversion/subversion/tests/cmdline/autoprop_tests.py  view on Meta::CPAN


#----------------------------------------------------------------------

def svn_prop_inheritable_autoprops_imp_no_yes(sbox):
  "inherit import: config=no,  commandline=yes"

  inheritable_autoprops_test(sbox, 'import', 0, 1, '')

#----------------------------------------------------------------------

def svn_prop_inheritable_autoprops_imp_yes_yes(sbox):
  "inherit import: config=yes, commandline=yes"

  inheritable_autoprops_test(sbox, 'import', 1, 1, '')

#----------------------------------------------------------------------

def svn_prop_inheritable_autoprops_imp_no_no(sbox):
  "inherit import: config=no,  commandline=no"

  inheritable_autoprops_test(sbox, 'import', 0, -1, '')

#----------------------------------------------------------------------

def svn_prop_inheritable_autoprops_imp_yes_no(sbox):
  "inherit import: config=yes, commandline=no"

  inheritable_autoprops_test(sbox, 'import', 1, -1, '')

#----------------------------------------------------------------------
# Test svn:auto-props when 'svn add' targets an already versioned
# target.
def svn_prop_inheritable_autoprops_add_versioned_target(sbox):
  "svn:auto-props and versioned target"

  config_dir = inheritable_autoprops_test(sbox, 'add', 1, 0, '', False)

  # Perform the add with the --force flag, and check the status.
  ### Note: You have to be inside the working copy or else Subversion
  ### will think you're trying to add the working copy to its parent
  ### directory, and will (possibly, if the parent directory isn't
  ### versioned) fail -- see also schedule_tests.py 11 "'svn add'
  ### should traverse already-versioned dirs"
  saved_wd = os.getcwd()
  os.chdir(sbox.wc_dir)
  svntest.main.run_svn(None, 'add', '.', '--force', '--config-dir',
                       config_dir)
  os.chdir(saved_wd)
  check_inheritable_autoprops(sbox, True, True)

  # Revert additions and try with --no-auto-props
  svntest.main.run_svn(None, 'revert', '-R', sbox.wc_dir)

  # When the add above sets svn:executable on D/rip.bat, subversion
  # also sets the execute bits on the file (on systems that support
  # that).  The revert above does not return the file to its original
  # permissions, so we do so manually now.  Otherwise the follwing
  # addition will notice the executable bits and set svn:executable
  # again, which is not what we are here to test.
  if os.name == 'posix':
    os.chmod(os.path.join(sbox.wc_dir, 'D', 'rip.bat'), 0664)

  os.chdir(sbox.wc_dir)
  svntest.main.run_svn(None, 'add', '.', '--force', '--no-auto-props',
                       '--config-dir', config_dir)
  os.chdir(saved_wd)
  check_inheritable_autoprops(sbox, False, False)

  # Create a new config with auto-props disabled.
  #
  # Then revert the previous additions and add again, only the
  # svn:auto-props should be applied.
  tmp_dir = os.path.abspath(svntest.main.temp_dir)
  config_dir = os.path.join(tmp_dir,
                            'autoprops_config_disabled_' + sbox.name)
  create_inherited_autoprops_config(config_dir, False)

  svntest.main.run_svn(None, 'revert', '-R', sbox.wc_dir)
  os.chdir(sbox.wc_dir)
  svntest.main.run_svn(None, 'add', '.', '--force',
                       '--config-dir', config_dir)
  os.chdir(saved_wd)
  check_inheritable_autoprops(sbox, False, True)

  # Revert  a final time and add again with the --auto-props switch.
  # Both the config defined and svn:auto-props should be applied.
  svntest.main.run_svn(None, 'revert', '-R', sbox.wc_dir)
  os.chdir(sbox.wc_dir)
  svntest.main.run_svn(None, 'add', '.', '--force', '--auto-props',
                       '--config-dir', config_dir)
  os.chdir(saved_wd)
  check_inheritable_autoprops(sbox, True, True)

#----------------------------------------------------------------------
# Can't set svn:auto-props on files.
def svn_prop_inheritable_autoprops_propset_file_target(sbox):
  "svn:auto-props can't be set on files"

  sbox.build()
  svntest.actions.run_and_verify_svn(
    None, None,
    ".*Cannot set '" + SVN_PROP_INHERITABLE_AUTOPROPS + "' on a file.*",
    'ps', SVN_PROP_INHERITABLE_AUTOPROPS, '*.c=svn:eol-style=native',
    sbox.ospath('iota'))

#----------------------------------------------------------------------
# Multiple unversioned subtrees under a versioned target shouldn't segfault.
def svn_prop_inheritable_autoprops_unversioned_subtrees_versioned_target(sbox):
  "versioned target and unversioned subtrees"

  sbox.build()
  Z_path = sbox.ospath('A/D/Z')
  Y_path = sbox.ospath('A/B/Y')
  foo_path = sbox.ospath('A/D/Z/foo.c')
  bar_path = sbox.ospath('A/B/Y/bar.c')

  # Set svn:auto-props properties on two directories.
  svntest.main.run_svn(None, 'ps', SVN_PROP_INHERITABLE_AUTOPROPS,
                       '*.c=svn:eol-style=CR', sbox.ospath('A/B'))
  svntest.main.run_svn(None, 'ps', SVN_PROP_INHERITABLE_AUTOPROPS,
                       '*.c=svn:eol-style=native', sbox.ospath('A/D'))



( run in 1.277 second using v1.01-cache-2.11-cpan-9288abcf80b )