Author: danielsh
Date: Sat Jul 24 11:47:30 2010
New Revision: 978853

URL: http://svn.apache.org/viewvc?rev=978853&view=rev
Log:
On the 'atomic-revprop' branch, merge r967266 through r978852 from trunk.

Added:
    
subversion/branches/atomic-revprop/subversion/tests/cmdline/svnrdump_tests_data/
      - copied from r978852, 
subversion/trunk/subversion/tests/cmdline/svnrdump_tests_data/
    
subversion/branches/atomic-revprop/subversion/tests/cmdline/svnrdump_tests_data/revision0.dump
      - copied unchanged from r978852, 
subversion/trunk/subversion/tests/cmdline/svnrdump_tests_data/revision0.dump
Modified:
    subversion/branches/atomic-revprop/   (props changed)
    subversion/branches/atomic-revprop/subversion/include/svn_config.h
    subversion/branches/atomic-revprop/subversion/libsvn_subr/config.c
    subversion/branches/atomic-revprop/subversion/tests/cmdline/patch_tests.py
    
subversion/branches/atomic-revprop/subversion/tests/cmdline/svnrdump_tests.py

Propchange: subversion/branches/atomic-revprop/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jul 24 11:47:30 2010
@@ -34,4 +34,4 @@
 /subversion/branches/tc_url_rev:874351-874483
 /subversion/branches/tree-conflicts:868291-873154
 /subversion/branches/tree-conflicts-notify:873926-874008
-/subversion/trunk:965046-967265
+/subversion/trunk:965046-978852

Modified: subversion/branches/atomic-revprop/subversion/include/svn_config.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/include/svn_config.h?rev=978853&r1=978852&r2=978853&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/include/svn_config.h 
(original)
+++ subversion/branches/atomic-revprop/subversion/include/svn_config.h Sat Jul 
24 11:47:30 2010
@@ -185,6 +185,15 @@ svn_config_get_config(apr_hash_t **cfg_h
                       apr_pool_t *pool);
 
 
+/** Set @a *cfgp to an empty @c svn_config_t structure,
+ * allocated in @a result_pool.
+ *
+ * @since New in 1.7.
+ */
+svn_error_t *
+svn_config_create(svn_config_t **cfgp,
+                  apr_pool_t *result_pool);
+
 /** Read configuration data from @a file (a file or registry path) into
  * @a *cfgp, allocated in @a pool.
  *

Modified: subversion/branches/atomic-revprop/subversion/libsvn_subr/config.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/libsvn_subr/config.c?rev=978853&r1=978852&r2=978853&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/libsvn_subr/config.c 
(original)
+++ subversion/branches/atomic-revprop/subversion/libsvn_subr/config.c Sat Jul 
24 11:47:30 2010
@@ -78,18 +78,29 @@ struct cfg_option_t
 
 
 svn_error_t *
+svn_config_create(svn_config_t **cfgp, apr_pool_t *result_pool)
+{
+  svn_config_t *cfg = apr_palloc(result_pool, sizeof(*cfg));
+
+  cfg->sections = apr_hash_make(result_pool);
+  cfg->pool = result_pool;
+  cfg->x_pool = svn_pool_create(result_pool);
+  cfg->x_values = FALSE;
+  cfg->tmp_key = svn_stringbuf_create("", result_pool);
+  cfg->tmp_value = svn_stringbuf_create("", result_pool);
+
+  *cfgp = cfg;
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
 svn_config_read(svn_config_t **cfgp, const char *file,
                 svn_boolean_t must_exist, apr_pool_t *pool)
 {
-  svn_config_t *cfg = apr_palloc(pool, sizeof(*cfg));
+  svn_config_t *cfg;
   svn_error_t *err;
 
-  cfg->sections = apr_hash_make(pool);
-  cfg->pool = pool;
-  cfg->x_pool = svn_pool_create(pool);
-  cfg->x_values = FALSE;
-  cfg->tmp_key = svn_stringbuf_create("", pool);
-  cfg->tmp_value = svn_stringbuf_create("", pool);
+  SVN_ERR(svn_config_create(&cfg, pool));
 
   /* Yes, this is platform-specific code in Subversion, but there's no
      practical way to migrate it into APR, as it's simultaneously

Modified: 
subversion/branches/atomic-revprop/subversion/tests/cmdline/patch_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/tests/cmdline/patch_tests.py?rev=978853&r1=978852&r2=978853&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/tests/cmdline/patch_tests.py 
(original)
+++ subversion/branches/atomic-revprop/subversion/tests/cmdline/patch_tests.py 
Sat Jul 24 11:47:30 2010
@@ -2162,7 +2162,6 @@ def patch_no_eol_at_eof(sbox):
                                        1, # check-props
                                        1) # dry-run
 
-### We need to add deletes and adds of properties to this test.
 def patch_with_properties(sbox):
   "patch with properties"
 
@@ -2172,10 +2171,13 @@ def patch_with_properties(sbox):
   patch_file_path = make_patch_path(sbox)
   iota_path = os.path.join(wc_dir, 'iota')
 
-  iota_prop_contents = "This is the property 'iota_prop'.\n"
+  modified_prop_contents = "This is the property 'modified'.\n"
+  deleted_prop_contents = "This is the property 'deleted'.\n"
 
-  # Set iota contents
-  svntest.main.run_svn(None, 'propset', 'prop', iota_prop_contents,
+  # Set iota prop contents
+  svntest.main.run_svn(None, 'propset', 'modified', modified_prop_contents,
+                       iota_path)
+  svntest.main.run_svn(None, 'propset', 'deleted', deleted_prop_contents,
                        iota_path)
   expected_output = svntest.wc.State(wc_dir, {
       'iota'    : Item(verb='Sending'),
@@ -2193,22 +2195,30 @@ def patch_with_properties(sbox):
     "+++ iota\t(working copy)\n",
     "Property changes on: iota\n",
     "-------------------------------------------------------------------\n",
-    "Modified: prop\n",
-    "## -1 +1 ""\n",
-    "-This is the property 'iota_prop'.\n",
-    "+This is the property 'prop'.\n",
+    "Modified: modified\n",
+    "## -1 +1 ##\n",
+    "-This is the property 'modified'.\n",
+    "+The property 'modified' has changed.\n",
+    "Added: added\n",
+    "## -0,0 +1 ""\n",
+    "+This is the property 'added'.\n",
+    "Deleted: deleted\n",
+    "## -1 +0,0 ##\n",
+    "-This is the property 'deleted'.\n",
   ]
 
   svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
 
-  iota_prop_contents = "This is the property 'prop'.\n"
+  modified_prop_contents = "The property 'modified' has changed.\n"
+  added_prop_contents = "This is the property 'added'.\n"
 
   expected_output = [
     'U         %s\n' % os.path.join(wc_dir, 'iota'),
   ]
 
   expected_disk = svntest.main.greek_state.copy()
-  expected_disk.tweak('iota', props={'prop' : iota_prop_contents})
+  expected_disk.tweak('iota', props={'modified' : modified_prop_contents,
+                                     'added' : added_prop_contents})
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
   expected_status.tweak('iota', status=' M')
 
@@ -2419,6 +2429,102 @@ def patch_same_twice(sbox):
                                        1, # check-props
                                        1) # dry-run
 
+def patch_dir_properties(sbox):
+  "patch with dir properties"
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  patch_file_path = make_patch_path(sbox)
+  A_path = os.path.join(wc_dir, 'A')
+  B_path = os.path.join(wc_dir, 'A', 'B')
+
+  modified_prop_contents = "This is the property 'modified'.\n"
+  deleted_prop_contents = "This is the property 'deleted'.\n"
+
+  # Set the properties
+  svntest.main.run_svn(None, 'propset', 'modified', modified_prop_contents,
+                       A_path)
+  svntest.main.run_svn(None, 'propset', 'deleted', deleted_prop_contents,
+                       B_path)
+  expected_output = svntest.wc.State(wc_dir, {
+      'A'    : Item(verb='Sending'),
+      'A/B'    : Item(verb='Sending'),
+      })
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('A', wc_rev=2)
+  expected_status.tweak('A/B', wc_rev=2)
+  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
+                                        expected_status, None, wc_dir)
+  # Apply patch
+
+  unidiff_patch = [
+    "Index: A\n",
+    "===================================================================\n",
+    "--- A\t(revision 1)\n",
+    "+++ A\t(working copy)\n",
+    "\n",
+    "Property changes on: A\n",
+    "-------------------------------------------------------------------\n",
+    "Modified: modified\n",
+    "## -1 +1 ##\n",
+    "-This is the property 'modified'.\n",
+    "+The property 'modified' has changed.\n",
+    "Added: svn:ignore\n",
+    "## -0,0 +1,3 ##\n",
+    "+*.o\n",
+    "+.libs\n",
+    "+*.lo\n",
+    "Index: A/B\n",
+    "===================================================================\n",
+    "--- A/B\t(revision 1)\n",
+    "+++ A/B\t(working copy)\n",
+    "\n",
+    "Property changes on: A/B\n",
+    "-------------------------------------------------------------------\n",
+    "Deleted: deleted\n",
+    "## -1 +0,0 ##\n",
+    "-This is the property 'deleted'.\n",
+    "Added: svn:executable\n",
+    "## -0,0 +1 ##\n",
+    "+*\n",
+  ]
+
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  modified_prop_contents = "The property 'modified' has changed.\n"
+  ignore_prop_contents = "*.o\n.libs\n*.lo\n"
+
+  ### The output for properties set on illegal targets (i.e. svn:excutable
+  ### on a dir) is still subject to change. We might just want to bail out 
+  ### directly instead of catching the error and use the notify mechanism.
+  expected_output = [
+    ' U        %s\n' % os.path.join(wc_dir, 'A'),
+    ' U        %s\n' % os.path.join(wc_dir, 'A', 'B'),
+    'Skipped missing target \'svn:executable\' on (\'%s\')' % B_path,
+    'Summary of conflicts:\n',
+    '  Skipped paths: 1\n',
+  ]
+
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.tweak('A', props={'modified' : modified_prop_contents,
+                                  'svn:ignore' : ignore_prop_contents})
+  expected_disk.tweak('A/B', props={})
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('A', status=' M')
+  expected_status.tweak('A/B', status=' M')
+
+  expected_skip = wc.State('', { })
+
+  svntest.actions.run_and_verify_patch(wc_dir, 
os.path.abspath(patch_file_path),
+                                       expected_output,
+                                       expected_disk,
+                                       expected_status,
+                                       expected_skip,
+                                       None, # expected err
+                                       1, # check-props
+                                       1) # dry-run
+
 ########################################################################
 #Run the tests
 
@@ -2444,6 +2550,7 @@ test_list = [ None,
               patch_no_eol_at_eof,
               XFail(patch_with_properties),
               patch_same_twice,
+              XFail(patch_dir_properties),
             ]
 
 if __name__ == '__main__':

Modified: 
subversion/branches/atomic-revprop/subversion/tests/cmdline/svnrdump_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/tests/cmdline/svnrdump_tests.py?rev=978853&r1=978852&r2=978853&view=diff
==============================================================================
--- 
subversion/branches/atomic-revprop/subversion/tests/cmdline/svnrdump_tests.py 
(original)
+++ 
subversion/branches/atomic-revprop/subversion/tests/cmdline/svnrdump_tests.py 
Sat Jul 24 11:47:30 2010
@@ -41,6 +41,55 @@ XFail = svntest.testcase.XFail
 Item = svntest.wc.StateItem
 Wimp = svntest.testcase.Wimp
 
+######################################################################
+# Helper routines
+
+def build_repos(sbox):
+  """Build an empty sandbox repository"""
+
+  # Cleanup after the last run by removing any left-over repository.
+  svntest.main.safe_rmtree(sbox.repo_dir)
+
+  # Create an empty repository.
+  svntest.main.create_repos(sbox.repo_dir)
+
+def run_test(sbox, dumpfile_name):
+  """Load a dumpfile using svnadmin load, dump it with svnrdump and
+  check that the same dumpfile is produced"""
+
+  # Create an empty sanbox repository
+  build_repos(sbox)
+
+  # This directory contains all the dump files
+  svnrdump_tests_dir = os.path.join(os.path.dirname(sys.argv[0]),
+                                   'svnrdump_tests_data')
+
+  # Load the specified dump file into the repository
+  svnadmin_dumpfile = open(os.path.join(svnrdump_tests_dir,
+                                        dumpfile_name),
+                           'rb').readlines()
+
+  # Load dumpfile_contents into the sbox repository
+  svntest.actions.run_and_verify_load(sbox.repo_dir, svnadmin_dumpfile)
+
+  # Create a dump file using svnrdump
+  r, svnrdump_dumpfile, err = svntest.main.run_svnrdump('-q', sbox.repo_url)
+
+  # Check error code
+  if (r != 0):
+    raise svntest.Failure('Result code not 0')
+
+  # Check the output from stderr
+  if err:
+    raise SVNUnexpectedStderr(err)
+
+  # Compare the output from stdout
+  svntest.verify.compare_and_display_lines(
+    "Dump files", "DUMP", svnadmin_dumpfile, svnrdump_dumpfile)
+
+######################################################################
+# Tests
+
 def basic_svnrdump(sbox):
   "dump the standard sbox repos"
   sbox.build(read_only = True, create_wc = False)
@@ -53,6 +102,10 @@ def basic_svnrdump(sbox):
   if not out[0].startswith('SVN-fs-dump-format-version:'):
     raise svntest.Failure('No valid output')
 
+def revision0(sbox):
+  "dump revision zero"
+  run_test(sbox, dumpfile_name = "revision0.dump")
+
 ########################################################################
 # Run the tests
 
@@ -60,6 +113,7 @@ def basic_svnrdump(sbox):
 # list all tests here, starting with None:
 test_list = [ None,
               basic_svnrdump,
+              revision0,
              ]
 
 if __name__ == '__main__':


Reply via email to