Modified: subversion/trunk/subversion/tests/cmdline/autoprop_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/autoprop_tests.py?rev=1401908&r1=1401907&r2=1401908&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/autoprop_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/autoprop_tests.py Wed Oct 24 
22:59:55 2012
@@ -42,6 +42,7 @@ Issue = svntest.testcase.Issue_deco
 Wimp = svntest.testcase.Wimp_deco
 Item = svntest.wc.StateItem
 
+from svntest.main import SVN_PROP_INHERITABLE_AUTOPROPS
 
 # Helper function
 def check_proplist(path, exp_out):
@@ -324,6 +325,348 @@ def fail_add_mixed_eol_style(sbox):
     {filename : Item(status='? ')})
   run_and_verify_unquiet_status(filepath, expected_status)
 
+#----------------------------------------------------------------------
+
+def create_inherited_autoprops_config(config_dir, enable_flag):
+  "create config stuffs for inherited autoprops tests"
+
+  # contents of the file 'config'
+  config_contents = '''\
+[auth]
+password-stores =
+
+[miscellany]
+enable-auto-props = %s
+
+[auto-props]
+*.c = svn:keywords=Author Date Id Rev URL;svn:eol-style=native;
+''' % (enable_flag and 'yes' or 'no')
+
+  svntest.main.create_config_dir(config_dir, config_contents)
+
+#----------------------------------------------------------------------
+def check_inheritable_autoprops(sbox, auto_props_enabled):
+  """Check that the autoprops added or imported by inheritable_autoprops_test
+     are as expected based on whether traditional auto props are active or
+     not, as indicated by AUTO_PROPS_ENABLED."""
+
+  foo_path = sbox.ospath('foo.c')
+  bar_path = sbox.ospath('B/bar.c')
+  baf_path = sbox.ospath('C/baf.c')
+  qux_path = sbox.ospath('D/qux.c')
+  rip_path = sbox.ospath('D/rip.bat')
+  snk_path = sbox.ospath('D/H/snk.py')
+  sir_path = sbox.ospath('D/H/sir.c')
+
+  if auto_props_enabled:
+    check_proplist(foo_path, {'svn:eol-style':'CRLF',
+                              'svn:keywords':'Author Date Id Rev URL'})
+    check_proplist(bar_path, {'svn:eol-style':'CR',
+                              'svn:keywords':'Date'})
+    check_proplist(baf_path, {'svn:eol-style':'LF',
+                              'svn:keywords':'Rev'})
+    check_proplist(qux_path, {'svn:eol-style':'CRLF',
+                              'svn:keywords':'Author Date Id Rev URL'})
+    check_proplist(rip_path, {'svn:executable':'*'})
+    check_proplist(snk_path, {'svn:mime-type':'text/x-python'})
+    check_proplist(sir_path, {'svn:eol-style':'CRLF',
+                              'svn:keywords':'Author Date Id Rev URL'})
+  else:
+    check_proplist(foo_path, {'svn:eol-style':'CRLF'})
+    check_proplist(bar_path, {'svn:eol-style':'CR',
+                              'svn:keywords':'Date'})
+    check_proplist(baf_path, {'svn:eol-style':'LF',
+                              'svn:keywords':'Rev'})
+    check_proplist(qux_path, {'svn:eol-style':'CRLF'})
+    check_proplist(rip_path, {'svn:executable':'*'})
+    check_proplist(snk_path, {'svn:mime-type':'text/x-python'})
+    check_proplist(sir_path, {'svn:eol-style':'CRLF'})
+
+#----------------------------------------------------------------------
+def inheritable_autoprops_test(sbox, cmd, cfgenable, clienable, subdir,
+                               do_import_or_add=True):
+  """configurable autoprops and svn:inheritable-auto-props test.
+
+     CMD is the subcommand to test: 'import' or 'add'
+     if CFGENABLE is true, enable autoprops in the config file, else disable
+     if CLIENABLE == 1: --auto-props is added to the command line
+                     0: nothing is added
+                    -1: --no-auto-props is added to command line
+     if string SUBDIR is not empty files are created in that subdir and the
+       directory is added/imported
+     if DO_IMPORT_OR_ADD is false, setup the test, but don't perform
+       the actual import or add.
+
+     Return the directory where the config dir (if any) is located."""
+
+  # Bootstrap
+  sbox.build()
+
+  # some directories
+  wc_dir = sbox.wc_dir
+  tmp_dir = os.path.abspath(svntest.main.temp_dir)
+  config_dir = os.path.join(tmp_dir, 'autoprops_config_' + sbox.name)
+  repos_url = sbox.repo_url
+
+  # initialize parameters
+  if cmd == 'import':
+    parameters = ['import', '-m', 'importing']
+    files_dir = tmp_dir
+  else:
+    parameters = ['add']
+    files_dir = wc_dir
+
+  parameters = parameters + ['--config-dir', config_dir]
+
+  create_inherited_autoprops_config(config_dir, cfgenable)
+
+  # add comandline flags
+  if clienable == 1:
+    parameters = parameters + ['--auto-props']
+    enable_flag = 1
+  elif clienable == -1:
+    parameters = parameters + ['--no-auto-props']
+    enable_flag = 0
+  else:
+    enable_flag = cfgenable
+
+  # setup subdirectory if needed
+  if len(subdir) > 0:
+    files_dir = os.path.join(files_dir, subdir)
+    files_wc_dir = os.path.join(wc_dir, subdir)
+    os.makedirs(files_dir)
+  else:
+    files_wc_dir = wc_dir
+
+  # Set differing svn:inheritable-auto-props properties on various
+  # directories.
+  sbox.simple_propset(SVN_PROP_INHERITABLE_AUTOPROPS,
+                      '*.c = svn:eol-style=CRLF\n'
+                      '*.bat = svn:executable',
+                      '.')
+  sbox.simple_propset(SVN_PROP_INHERITABLE_AUTOPROPS,
+                      '*.c = svn:eol-style=CR;svn:keywords=Date',
+                      'A/B')
+  sbox.simple_propset(SVN_PROP_INHERITABLE_AUTOPROPS,
+                      '*.c = svn:eol-style=LF;svn:keywords=Rev',
+                      'A/C')
+  sbox.simple_propset(SVN_PROP_INHERITABLE_AUTOPROPS,
+                      '*.py = svn:mime-type=text/x-python',
+                      'A/D')
+  svntest.actions.run_and_verify_svn(None, None, [], 'ci', '-m',
+                                     'Add some ' + 
SVN_PROP_INHERITABLE_AUTOPROPS +
+                                     ' properties', wc_dir)
+
+  # Switch the root of the WC to ^/A.
+  svntest.main.run_svn(None, 'switch', '--ignore-ancestry',
+                       sbox.repo_url + '/A', wc_dir)
+
+  # Array of file names to add or import, their WC locations (relative to the
+  # WC root) if being added, and their repository locations if being imported.
+  filenames = [['foo.c',  'foo.c',                           'A/foo.c'],
+               ['bar.c',   os.path.join('B', 'bar.c'),       'A/B/bar.c'],
+               ['baf.c',   os.path.join('C', 'baf.c'),       'A/C/baf.c'],
+               ['qux.c',   os.path.join('D', 'qux.c'),       'A/D/qux.c'],
+               ['rip.bat', os.path.join('D', 'rip.bat'),     'A/D/rip.bat'],
+               ['snk.py',  os.path.join('D', 'H', 'snk.py'), 'A/D/H/snk.py'],
+               ['ric.c',   os.path.join('D', 'H', 'sir.c'),  'A/D/H/sir.c']]
+
+  for filename in filenames:
+    if cmd == 'import':
+      svntest.main.file_write(os.path.join(files_dir, filename[0]),
+                              'foo\nbar\nbaz\n')
+    else:
+      svntest.main.file_write(os.path.join(files_dir, filename[1]),
+                              'foo\nbar\nbaz\n')
+
+  if do_import_or_add:
+    if len(subdir) == 0:
+      # add/import the files
+      for filename in filenames:
+        if cmd == 'import':
+          path = os.path.join(files_dir, filename[0])
+          tmp_params = parameters + [path, repos_url + '/' + filename[2]]
+        else:
+          path = os.path.join(files_dir, filename[1])
+          tmp_params = parameters + [path]
+        svntest.main.run_svn(None, *tmp_params)
+    else:
+      # add/import subdirectory
+      if cmd == 'import':
+        parameters = parameters + [files_dir, repos_url]
+      else:
+        parameters = parameters + [files_wc_dir]
+      svntest.main.run_svn(None, *parameters)
+
+    # do an svn co if needed
+    if cmd == 'import':
+      svntest.main.run_svn(None, 'checkout', repos_url + '/A', files_wc_dir,
+                          '--config-dir', config_dir)
+
+    check_inheritable_autoprops(sbox, enable_flag)
+
+  return config_dir
+
+#----------------------------------------------------------------------
+
+def svn_prop_inheritable_autoprops_add_no_none(sbox):
+  "inherit add: config=no, commandline=none"
+  inheritable_autoprops_test(sbox, 'add', False, 0, '')
+
+#----------------------------------------------------------------------
+
+def svn_prop_inheritable_autoprops_add_yes_none(sbox):
+  "inherit add: config=yes,  commandline=none"
+  inheritable_autoprops_test(sbox, 'add', True, 0, '')
+
+#----------------------------------------------------------------------
+
+def svn_prop_inheritable_autoprops_add_no_yes(sbox):
+  "inherit add: config=no,  commandline=yes"
+
+  inheritable_autoprops_test(sbox, 'add', 0, 1, '')
+
+#----------------------------------------------------------------------
+
+def svn_prop_inheritable_autoprops_add_yes_yes(sbox):
+  "inherit add: config=yes, commandline=yes"
+
+  inheritable_autoprops_test(sbox, 'add', 1, 1, '')
+
+#----------------------------------------------------------------------
+
+def svn_prop_inheritable_autoprops_add_no_no(sbox):
+  "inherit add: config=no,  commandline=no"
+
+  inheritable_autoprops_test(sbox, 'add', 0, -1, '')
+
+#----------------------------------------------------------------------
+
+def svn_prop_inheritable_autoprops_add_yes_no(sbox):
+  "inherit add: config=yes, commandline=no"
+
+  inheritable_autoprops_test(sbox, 'add', 1, -1, '')
+
+#----------------------------------------------------------------------
+
+def svn_prop_inheritable_autoprops_import_no_none(sbox):
+  "inherit import: config=no, commandline=none"
+
+  inheritable_autoprops_test(sbox, 'import', False, 0, '')
+
+#----------------------------------------------------------------------
+
+def svn_prop_inheritable_autoprops_imp_yes_none(sbox):
+  "inherit import: config=yes, commandline=none"
+
+  inheritable_autoprops_test(sbox, 'import', 1, 0, '')
+
+#----------------------------------------------------------------------
+
+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:inheritable-auto-props when 'svn add' targets an already versioned
+# target.
+def svn_prop_inheritable_autoprops_add_versioned_target(sbox):
+  "svn:inheritable-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)
+
+#----------------------------------------------------------------------
+# Can't set svn:inheritable-auto-props on files.
+def svn_prop_inheritable_autoprops_propset_file_target(sbox):
+  "svn:inheritable-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:inheritable-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'))
+  svntest.main.run_svn(None, 'ci', '-m', 'Add inheritable autoprops',
+                       sbox.wc_dir)
+
+  # Create two subtrees, each with one new file.
+  os.mkdir(Z_path)
+  os.mkdir(Y_path)
+  svntest.main.file_write(foo_path,
+                          '/* Someday there will be code here. */\n')
+  svntest.main.file_write(bar_path,
+                          '/* Someday there will be code here. */\n')
+
+  # Perform the add with the --force flag, targeting the root of the WC.
+  ### 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)
+  # This was causing a segfault at one point.
+  svntest.main.run_svn(None, 'add', '.', '--force')
+  os.chdir(saved_wd)
+
+  # Check the resulting autoprops.
+  svntest.actions.run_and_verify_svn(None, 'native\n', [],
+                                     'pg', 'svn:eol-style', foo_path)
+  svntest.actions.run_and_verify_svn(None, 'CR\n', [],
+                                     'pg', 'svn:eol-style', bar_path)
 
 ########################################################################
 # Run the tests
@@ -346,6 +689,21 @@ test_list = [ None,
               autoprops_add_dir,
               autoprops_imp_dir,
               fail_add_mixed_eol_style,
+              svn_prop_inheritable_autoprops_add_no_none,
+              svn_prop_inheritable_autoprops_add_yes_none,
+              svn_prop_inheritable_autoprops_add_no_yes,
+              svn_prop_inheritable_autoprops_add_yes_yes,
+              svn_prop_inheritable_autoprops_add_no_no,
+              svn_prop_inheritable_autoprops_add_yes_no,
+              svn_prop_inheritable_autoprops_import_no_none,
+              svn_prop_inheritable_autoprops_imp_yes_none,
+              svn_prop_inheritable_autoprops_imp_no_yes,
+              svn_prop_inheritable_autoprops_imp_yes_yes,
+              svn_prop_inheritable_autoprops_imp_no_no,
+              svn_prop_inheritable_autoprops_imp_yes_no,
+              svn_prop_inheritable_autoprops_add_versioned_target,
+              svn_prop_inheritable_autoprops_propset_file_target,
+              
svn_prop_inheritable_autoprops_unversioned_subtrees_versioned_target,
              ]
 
 if __name__ == '__main__':

Modified: subversion/trunk/subversion/tests/cmdline/import_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/import_tests.py?rev=1401908&r1=1401907&r2=1401908&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/import_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/import_tests.py Wed Oct 24 
22:59:55 2012
@@ -25,11 +25,13 @@
 ######################################################################
 
 # General modules
-import re, os.path
+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
@@ -407,6 +409,163 @@ def import_into_foreign_repo(sbox):
                                      sbox.ospath('A/mu'), other_repo_url + 
'/f')
 
 #----------------------------------------------------------------------
+def import_inherited_ignores(sbox):
+  'import and inherited ignores'
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  # Create this config file:
+  #
+  #   [miscellany]
+  #   global-ignores = *.boo *.goo
+  tmp_dir = os.path.abspath(svntest.main.temp_dir)
+  config_dir = os.path.join(tmp_dir, 'autoprops_config_' + sbox.name)
+  create_inherited_ignores_config(config_dir)
+
+  # Set some ignore properties.
+  sbox.simple_propset(SVN_PROP_INHERITABLE_IGNORES, '*.voo *.noo *.loo', '.')
+  sbox.simple_propset(SVN_PROP_INHERITABLE_IGNORES, '*.yoo\t*.doo', 'A/B')
+  sbox.simple_propset(SVN_PROP_INHERITABLE_IGNORES, '*.moo', 'A/D')
+  sbox.simple_propset('svn:ignore', '*.zoo\n*.foo\n*.poo', 'A/B/E')
+  sbox.simple_commit()
+
+  # Use this tree for importing:
+  #
+  # DIR1.noo
+  # DIR2.doo
+  #   file1.txt
+  # DIR3.foo
+  #   file2.txt
+  # DIR4.goo
+  #   file3.txt
+  #   file4.noo
+  # DIR5.moo
+  #   file5.txt
+  # DIR6
+  #   file6.foo
+  #   DIR7
+  #     file7.foo
+  #     DIR8.noo
+  import_tree_dir = os.path.join(os.path.dirname(sys.argv[0]),
+                                 'import_tests_data', 'import_tree')
+
+  # Relative WC paths of the imported tree.
+  dir1_path  = os.path.join('DIR1.noo')
+  dir2_path  = os.path.join('DIR2.doo')
+  file1_path = os.path.join('DIR2.doo', 'file1.txt')
+  dir3_path  = os.path.join('DIR3.foo')
+  file2_path = os.path.join('DIR3.foo', 'file2.txt')
+  dir4_path  = os.path.join('DIR4.goo')
+  file3_path = os.path.join('DIR4.goo', 'file3.txt')
+  file4_path = os.path.join('DIR4.goo', 'file4.txt')
+  dir5_path  = os.path.join('DIR5.moo')
+  file5_path = os.path.join('DIR5.moo', 'file5.txt')
+  dir6_path  = os.path.join('DIR6')
+  file6_path = os.path.join('DIR6', 'file6.foo')
+  dir7_path  = os.path.join('DIR6', 'DIR7')
+  file7_path = os.path.join('DIR6', 'DIR7', 'file7.foo')
+  dir8_path  = os.path.join('DIR6', 'DIR7', 'DIR8.noo')
+
+  # Import the tree to ^/A/B/E.
+  # We should never see any *.noo paths because those are blocked at the
+  # root of the repository by the svn:inheritable-ignores property.  Likewise
+  # *.doo paths are blocked by the svn:inheritable-ignores on ^/A/B.  Nor
+  # should we see and *.boo or *.goo paths, as those are blocked by the
+  # global-ignores config. Lastly, ^/A/B/E should not get any *.foo paths
+  # because of the svn:ignore property on ^/A/B/E, but non-immediate children
+  # of ^/A/B/E are permitted *.foo paths.
+  svntest.actions.run_and_verify_svn(None, None, [], 'import',
+                                     '--config-dir', config_dir,
+                                     import_tree_dir,
+                                     sbox.repo_url + '/A/B/E',
+                                     '-m', 'import')
+  E_path = os.path.join(wc_dir, 'A', 'B', 'E')
+  expected_output = svntest.verify.UnorderedOutput(
+    ["Updating '" + wc_dir + "':\n",
+     'A    ' + os.path.join(E_path, dir5_path)  + '\n',
+     'A    ' + os.path.join(E_path, file5_path) + '\n',
+     'A    ' + os.path.join(E_path, dir6_path)  + '\n',
+     'A    ' + os.path.join(E_path, file6_path) + '\n',
+     'A    ' + os.path.join(E_path, dir7_path)  + '\n',
+     'A    ' + os.path.join(E_path, file7_path) + '\n',
+     'Updated to revision 3.\n'])
+  svntest.actions.run_and_verify_svn(None, expected_output, [], 'up', wc_dir)
+
+  # Import the tree to ^/A/B/E/Z.  The only difference from above is that
+  # DIR3.foo and its child file2.txt are also imported.  Why? Because now
+  # we are creating a new directory in ^/A/B/E, so the svn:ignore property
+  # set on ^/A/B/E doesn't apply.
+  svntest.actions.run_and_verify_svn(None, None, [], 'import',
+                                     '--config-dir', config_dir,
+                                     import_tree_dir,
+                                     sbox.repo_url + '/A/B/E/Z',
+                                     '-m', 'import')
+  Z_path = os.path.join(wc_dir, 'A', 'B', 'E', 'Z')
+  expected_output = svntest.verify.UnorderedOutput(
+    ["Updating '" + wc_dir + "':\n",
+     'A    ' + os.path.join(Z_path)             + '\n',
+     'A    ' + os.path.join(Z_path, dir5_path)  + '\n',
+     'A    ' + os.path.join(Z_path, file5_path) + '\n',
+     'A    ' + os.path.join(Z_path, dir6_path)  + '\n',
+     'A    ' + os.path.join(Z_path, file6_path) + '\n',
+     'A    ' + os.path.join(Z_path, dir7_path)  + '\n',
+     'A    ' + os.path.join(Z_path, file7_path) + '\n',
+     'A    ' + os.path.join(Z_path, dir3_path)  + '\n',
+     'A    ' + os.path.join(Z_path, file2_path) + '\n',
+     'Updated to revision 4.\n'])
+  svntest.actions.run_and_verify_svn(None, expected_output, [], 'up', wc_dir)
+
+  # Import the tree to ^/A/B/F with the --no-ignore option.
+  # Now only the ignores present in the svn:inheritable-ignores property
+  # should be considered.
+  svntest.actions.run_and_verify_svn(None, None, [], 'import',
+                                     '--config-dir', config_dir,
+                                     '--no-ignore', import_tree_dir,
+                                     sbox.repo_url + '/A/B/F',
+                                     '-m', 'import')
+  F_path = os.path.join(wc_dir, 'A', 'B', 'F')
+  expected_output = svntest.verify.UnorderedOutput(
+    ["Updating '" + wc_dir + "':\n",
+     'A    ' + os.path.join(F_path, dir3_path)  + '\n',
+     'A    ' + os.path.join(F_path, file2_path) + '\n',
+     'A    ' + os.path.join(F_path, dir4_path)  + '\n',
+     'A    ' + os.path.join(F_path, file3_path) + '\n',
+     'A    ' + os.path.join(F_path, dir5_path)  + '\n',
+     'A    ' + os.path.join(F_path, file5_path) + '\n',
+     'A    ' + os.path.join(F_path, dir6_path)  + '\n',
+     'A    ' + os.path.join(F_path, file6_path) + '\n',
+     'A    ' + os.path.join(F_path, dir7_path)  + '\n',
+     'A    ' + os.path.join(F_path, file7_path) + '\n',
+     'Updated to revision 5.\n'])
+  svntest.actions.run_and_verify_svn(None, expected_output, [], 'up', wc_dir)
+
+  # Try importing a single file into a directory which has svn:ignore set
+  # on it with a matching pattern of the imported file.  The import should
+  # be a no-op.
+  svntest.actions.run_and_verify_svn(None, [], [], 'import',
+                                     '--config-dir', config_dir,
+                                     os.path.join(import_tree_dir,
+                                                  'DIR6', 'file6.foo'), 
+                                     sbox.repo_url + '/A/B/E/file6.foo',
+                                     '-m', 'This import should fail!')
+
+  # Try the above, but this time with --no-ignore, this time the import
+  # should succeed.
+  svntest.actions.run_and_verify_svn(None, None, [], 'import', '--no-ignore',
+                                     '--config-dir', config_dir,
+                                     os.path.join(import_tree_dir,
+                                                  'DIR6', 'file6.foo'), 
+                                     sbox.repo_url + '/A/B/E/file6.foo',
+                                     '-m', 'import')
+  expected_output = svntest.verify.UnorderedOutput(
+    ["Updating '" + wc_dir + "':\n",
+     'A    ' + os.path.join(E_path, 'file6.foo') + '\n',
+     'Updated to revision 6.\n'])
+  svntest.actions.run_and_verify_svn(None, expected_output, [], 'up', wc_dir)
+
+#----------------------------------------------------------------------
+
 ########################################################################
 # Run the tests
 
@@ -419,6 +578,7 @@ test_list = [ None,
               import_no_ignores,
               import_eol_style,
               import_into_foreign_repo,
+              import_inherited_ignores,
              ]
 
 if __name__ == '__main__':

Propchange: subversion/trunk/subversion/tests/cmdline/import_tests_data/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Wed Oct 24 22:59:55 2012
@@ -0,0 +1,2 @@
+[Ii]ssues?:?(\s*(,|and)?\s*#\d+)+
+(\d+)

Propchange: subversion/trunk/subversion/tests/cmdline/import_tests_data/
------------------------------------------------------------------------------
    bugtraq:url = http://subversion.tigris.org/issues/show_bug.cgi?id=%BUGID%

Propchange: subversion/trunk/subversion/tests/cmdline/import_tests_data/
------------------------------------------------------------------------------
    tsvn:logwidthmarker = 78

Modified: subversion/trunk/subversion/tests/cmdline/prop_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/prop_tests.py?rev=1401908&r1=1401907&r2=1401908&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/prop_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/prop_tests.py Wed Oct 24 22:59:55 
2012
@@ -33,6 +33,8 @@ logger = logging.getLogger()
 import svntest
 
 from svntest.main import SVN_PROP_MERGEINFO
+from svntest.main import SVN_PROP_INHERITABLE_IGNORES
+from svntest import wc
 
 # (abbreviation)
 Skip = svntest.testcase.Skip_deco
@@ -2507,6 +2509,167 @@ def pristine_props_listed(sbox):
   svntest.actions.run_and_verify_svn(None, expected_output, [],
                                      'proplist', '-R', wc_dir, '-r', 'BASE')
 
+def create_inherited_ignores_config(config_dir):
+  "create config stuffs for inherited ignores tests"
+
+  # contents of the file 'config'
+  config_contents = '''\
+[miscellany]
+global-ignores = *.boo *.goo
+'''
+
+  svntest.main.create_config_dir(config_dir, config_contents)
+
+def inheritable_ignores(sbox):
+  "inheritable ignores with svn:ignores and config"
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  tmp_dir = os.path.abspath(svntest.main.temp_dir)
+  config_dir = os.path.join(tmp_dir, 'autoprops_config_' + sbox.name)
+  create_inherited_ignores_config(config_dir)
+
+  sbox.simple_propset(SVN_PROP_INHERITABLE_IGNORES, '*.doo', 'A/B')
+  sbox.simple_propset(SVN_PROP_INHERITABLE_IGNORES, '*.moo', 'A/D')
+  sbox.simple_propset('svn:ignore', '*.foo', 'A/B/E')
+  sbox.simple_commit()
+
+  # Some directories and files that should be added because they don't
+  # match any applicable ignores.
+  X_dir_path = os.path.join(wc_dir, 'ADD-ME-DIR-X')
+  Y_dir_path = os.path.join(wc_dir, 'A', 'ADD-ME-DIR-Y.doo')
+  Z_dir_path = os.path.join(wc_dir, 'A', 'D', 'G', 'ADD-ME-DIR-Z.doo')
+  os.mkdir(X_dir_path)
+  os.mkdir(Y_dir_path)
+  os.mkdir(Z_dir_path)
+
+  # Some directories and files that should be ignored when adding
+  # because they match an ignore pattern (unless of course they are
+  # the direct target of an add, which we always add).
+  boo_dir_path = os.path.join(wc_dir, 'IGNORE-ME-DIR.boo')
+  goo_dir_path = os.path.join(wc_dir, 'IGNORE-ME-DIR.boo', 'IGNORE-ME-DIR.goo')
+  doo_dir_path = os.path.join(wc_dir, 'A', 'B', 'IGNORE-ME-DIR.doo')
+  moo_dir_path = os.path.join(wc_dir, 'A', 'D', 'IGNORE-ME-DIR.moo')
+  foo_dir_path = os.path.join(wc_dir, 'A', 'B', 'E', 'IGNORE-ME-DIR.foo')
+  os.mkdir(boo_dir_path)
+  os.mkdir(goo_dir_path)
+  os.mkdir(doo_dir_path)
+  os.mkdir(moo_dir_path)
+  os.mkdir(foo_dir_path)
+  boo_file_path = sbox.ospath('ADD-ME-DIR-X/ignore-me-file.boo')
+  goo_file_path = sbox.ospath('A/D/G/ignore-me-file.goo')
+  doo_file_path = sbox.ospath('A/B/IGNORE-ME-DIR.doo/ignore-me-file.doo')
+  doo_file2_path = sbox.ospath('A/B/E/ignore-me-file.doo')
+  moo_file_path = sbox.ospath('A/D/ignore-me-file.moo')
+  foo_file_path = sbox.ospath('A/B/E/ignore-me-file.foo')
+  svntest.main.file_write(boo_file_path, 'I should not be versioned!\n')
+  svntest.main.file_write(goo_file_path, 'I should not be versioned!\n')
+  svntest.main.file_write(doo_file_path, 'I should not be versioned!\n')
+  svntest.main.file_write(doo_file2_path, 'I should not be versioned!\n')
+  svntest.main.file_write(moo_file_path, 'I should not be versioned!\n')
+  svntest.main.file_write(foo_file_path, 'I should not be versioned!\n')
+
+  # Some directories and files that don't match any ignore pattern
+  # but are located within a subtree that does match and so shouldn't
+  # be added.
+  roo_file_path = sbox.ospath('A/B/IGNORE-ME-DIR.doo/ignore-me-file.roo')
+  svntest.main.file_write(roo_file_path, 'I should not be versioned!\n')
+
+  # Check (non-verbose) status with the custom config. We should only see
+  # the three unversioned directories which don't match any of the ignore
+  # patterns and aren't proper subtrees of an unversioned or ignored
+  # subtree.
+  expected_output = svntest.verify.UnorderedOutput(
+    ['?       ' + X_dir_path + '\n',
+     '?       ' + Y_dir_path + '\n',
+     '?       ' + Z_dir_path + '\n',])
+  svntest.actions.run_and_verify_svn(None, expected_output, [], 'st',
+                                     '--config-dir', config_dir, wc_dir)
+
+  # Check status without the custom config.
+  # Should be the same as above except the *.boo and *.goo paths
+  # now show up as unversioned '?'.
+  expected_output = svntest.verify.UnorderedOutput(
+    ['?       ' + X_dir_path    + '\n',
+     '?       ' + Y_dir_path    + '\n',
+     '?       ' + Z_dir_path    + '\n',
+     '?       ' + boo_dir_path  + '\n',
+     '?       ' + goo_file_path + '\n',])
+  svntest.actions.run_and_verify_svn(None, expected_output, [], 'st', wc_dir)
+
+  # Check status with the custom config and --no-ignore.
+  expected_output = svntest.verify.UnorderedOutput(
+    ['?       ' + X_dir_path     + '\n',
+     '?       ' + Y_dir_path     + '\n',
+     '?       ' + Z_dir_path     + '\n',
+     'I       ' + boo_dir_path   + '\n',
+     'I       ' + doo_dir_path   + '\n',
+     'I       ' + doo_file2_path + '\n',
+     'I       ' + moo_dir_path   + '\n',
+     'I       ' + foo_dir_path   + '\n',
+     'I       ' + goo_file_path  + '\n',
+     'I       ' + moo_file_path  + '\n',
+     'I       ' + foo_file_path  + '\n',])
+  svntest.actions.run_and_verify_svn(None, expected_output, [], 'st',
+                                     '--config-dir', config_dir,
+                                     '--no-ignore', wc_dir)
+
+  # Check status without the custom config and --no-ignore.
+  # Should be the same as above except the *.boo and *.goo paths
+  # are reported as unversioned '?' rather than ignored 'I'.
+  expected_output = svntest.verify.UnorderedOutput(
+    ['?       ' + X_dir_path     + '\n',
+     '?       ' + Y_dir_path     + '\n',
+     '?       ' + Z_dir_path     + '\n',
+     '?       ' + boo_dir_path   + '\n',
+     'I       ' + doo_dir_path   + '\n',
+     'I       ' + doo_file2_path + '\n',
+     'I       ' + moo_dir_path   + '\n',
+     'I       ' + foo_dir_path   + '\n',
+     '?       ' + goo_file_path  + '\n',
+     'I       ' + moo_file_path  + '\n',
+     'I       ' + foo_file_path  + '\n',])
+  svntest.actions.run_and_verify_svn(None, expected_output, [], 'st',
+                                     '--no-ignore', wc_dir)
+
+  # Perform the add with the --force flag, targeting the root of the WC.
+  ### 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)
+  expected = svntest.verify.UnorderedOutput(
+    ['A         ' + 'ADD-ME-DIR-X\n',
+     'A         ' + os.path.join('A', 'ADD-ME-DIR-Y.doo') + '\n',
+     'A         ' + os.path.join('A', 'D', 'G', 'ADD-ME-DIR-Z.doo') + '\n'])
+  svntest.actions.run_and_verify_svn("Adds in spite of ignores", expected,
+                                     [], 'add', '.', '--force',
+                                     '--config-dir', config_dir)
+  os.chdir(saved_wd)
+
+  # Now revert and try the add with the --no-ignore flag, only the
+  # svn:inheritable-ignores should be enforced.
+  svntest.actions.run_and_verify_svn(None, None, [], 'revert', wc_dir, '-R')
+  saved_wd = os.getcwd()
+  os.chdir(sbox.wc_dir)
+  expected = svntest.verify.UnorderedOutput(
+    ['A         ' + 'ADD-ME-DIR-X\n',
+     'A         ' + os.path.join('A', 'ADD-ME-DIR-Y.doo') + '\n',
+     'A         ' + os.path.join('A', 'D', 'G', 'ADD-ME-DIR-Z.doo') + '\n',
+     'A         ' + os.path.join('ADD-ME-DIR-X', 'ignore-me-file.boo') + '\n',
+     'A         ' + 'IGNORE-ME-DIR.boo' + '\n',
+     'A         ' + os.path.join('IGNORE-ME-DIR.boo',
+                                 'IGNORE-ME-DIR.goo') + '\n',
+     'A         ' + os.path.join('A', 'B', 'E', 'IGNORE-ME-DIR.foo') + '\n',
+     'A         ' + os.path.join('A', 'B', 'E', 'ignore-me-file.foo') + '\n',
+     'A         ' + os.path.join('A', 'D', 'G', 'ignore-me-file.goo') + '\n'])
+  svntest.actions.run_and_verify_svn("Adds in spite of ignores", expected,
+                                     [], 'add', '.', '--force','--no-ignore',
+                                     '--config-dir', config_dir)
+
 ########################################################################
 # Run the tests
 
@@ -2549,6 +2712,7 @@ test_list = [ None,
               propget_redirection,
               file_matching_dir_prop_reject,
               pristine_props_listed,
+              inheritable_ignores,
              ]
 
 if __name__ == '__main__':

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1401908&r1=1401907&r2=1401908&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Wed Oct 24 
22:59:55 2012
@@ -174,6 +174,12 @@ work_dir = "svn-test-work"
 # Constant for the merge info property.
 SVN_PROP_MERGEINFO = "svn:mergeinfo"
 
+# Constant for the inheritabled auto-props property.
+SVN_PROP_INHERITABLE_AUTOPROPS = "svn:inheritable-auto-props"
+
+# Constant for the inheritabled ignores property.
+SVN_PROP_INHERITABLE_IGNORES = "svn:inheritable-ignores"
+
 # Where we want all the repositories and working copies to live.
 # Each test will have its own!
 general_repo_dir = os.path.join(work_dir, "repositories")

Propchange: subversion/trunk/tools/dist/make-deps-tarball.sh
------------------------------------------------------------------------------
  Merged 
/subversion/branches/auto-props-sdc/tools/dist/make-deps-tarball.sh:r1384106-1401643


Reply via email to