Alien-SVN

 view release on metacpan or  search on metacpan

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


  svntest.main.run_svn(None,
                       'up', wc_dir)

  # check that the symlink is still there
  target = os.readlink(mu_path)
  if target != iota_path:
    raise svntest.Failure


def warn_on_reserved_name(sbox):
  "warn when attempt operation on a reserved name"
  sbox.build()
  reserved_path = os.path.join(sbox.wc_dir, svntest.main.get_admin_name())
  svntest.actions.run_and_verify_svn(
    "Locking a file with a reserved name failed to result in an error",
    None,
    ".*Skipping argument: E200025: '.+' ends in a reserved name.*",
    'lock', reserved_path)


def propvalue_normalized(sbox):
  "'ps svn:special' should normalize to '*'"

  sbox.build()
  wc_dir = sbox.wc_dir

  # Add a "symlink"
  iota2_path = sbox.ospath('iota2')
  svntest.main.file_write(iota2_path, "symlink destination")
  svntest.main.run_svn(None, 'add', iota2_path)
  svntest.main.run_svn(None, 'propset', 'svn:special', 'yes', iota2_path)
  if svntest.main.is_posix_os():
    os.remove(iota2_path)
    os.symlink("symlink destination", iota2_path)

  # Property value should be SVN_PROP_BOOLEAN_TRUE
  expected_propval = ['*']
  svntest.actions.run_and_verify_svn(None, expected_propval, [],
                                     'propget', '--strict', 'svn:special',
                                     iota2_path)

  # Commit and check again.
  expected_output = svntest.wc.State(wc_dir, {
    'iota2' : Item(verb='Adding'),
    })
  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
  expected_status.add({
    'iota2' : Item(status='  ', wc_rev=2),
    })
  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
                                        expected_status, None,
                                        wc_dir)

  svntest.main.run_svn(None, 'update', wc_dir)
  svntest.actions.run_and_verify_svn(None, expected_propval, [],
                                     'propget', '--strict', 'svn:special',
                                     iota2_path)


# on users@: http://mid.gmane.org/1292856447.8650.24.camel@nimble.325Bayport
@SkipUnless(svntest.main.is_posix_os)
def unrelated_changed_special_status(sbox):
  "commit foo while bar changed special status"

  sbox.build()
  wc_dir = sbox.wc_dir

  os.chdir(os.path.join(sbox.wc_dir, 'A/D/H'))

  open('chi', 'a').write('random local mod')
  os.unlink('psi')
  os.symlink('omega', 'psi') # omega is versioned!
  svntest.main.run_svn(None, 'changelist', 'chi cl', 'chi')
  svntest.actions.run_and_verify_svn(None, None, [], 'commit',
                                     '--changelist', 'chi cl',
                                     '-m', 'psi changed special status')

#----------------------------------------------------------------------
@Issue(3972)
def symlink_destination_change(sbox):
  "revert a symlink destination change"

  sbox.build()
  wc_dir = sbox.wc_dir

  # Create a new symlink and commit it.
  newfile_path = os.path.join(wc_dir, 'newfile')
  sbox.simple_add_symlink('linktarget', 'newfile')

  expected_output = svntest.wc.State(wc_dir, {
    'newfile' : Item(verb='Adding'),
    })

  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
  expected_status.add({
    'newfile' : Item(status='  ', wc_rev=2),
    })

  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
                                        expected_status, None, wc_dir)

  # Modify the symlink to point somewhere else
  os.remove(newfile_path)
  if svntest.main.is_posix_os():
    os.symlink('linktarget2', newfile_path)
  else:
    sbox.simple_append('newfile', 'link linktarget2', truncate = True)

  expected_status.tweak('newfile', status='M ')
  svntest.actions.run_and_verify_status(wc_dir, expected_status)

  # Revert should restore the symlink to point to the original destination
  svntest.main.run_svn(None, 'revert', '-R', wc_dir)
  expected_status.tweak('newfile', status='  ')
  svntest.actions.run_and_verify_status(wc_dir, expected_status)

  # Issue 3972, repeat revert produces no output
  svntest.actions.run_and_verify_svn(None, [], [], 'revert', '-R', wc_dir)
  svntest.actions.run_and_verify_status(wc_dir, expected_status)



( run in 1.208 second using v1.01-cache-2.11-cpan-5735350b133 )