You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by sv...@apache.org on 2013/01/17 05:02:15 UTC

svn commit: r1434548 - in /subversion/branches/1.7.x: ./ STATUS subversion/svnrdump/load_editor.c subversion/svnrdump/svnrdump.h subversion/svnrdump/util.c subversion/tests/cmdline/svnrdump_tests.py

Author: svn-role
Date: Thu Jan 17 04:02:15 2013
New Revision: 1434548

URL: http://svn.apache.org/viewvc?rev=1434548&view=rev
Log:
Reintegrate the 1.7.x-issue4263 branch:

 * ^/subversion/branches/1.7.x-issue4263
   Fix svnrdump inability to load dump files with non-LF line endings in
   'svn:*' properties.
   Justification:
     Other tools have had this issue resolved, svnrdump should as well.
   Branch:
     ^/subversion/branches/1.7.x-issue4263
   Votes:
     +1: breser, danielsh, rhuijben

Modified:
    subversion/branches/1.7.x/   (props changed)
    subversion/branches/1.7.x/STATUS
    subversion/branches/1.7.x/subversion/svnrdump/load_editor.c
    subversion/branches/1.7.x/subversion/svnrdump/svnrdump.h
    subversion/branches/1.7.x/subversion/svnrdump/util.c
    subversion/branches/1.7.x/subversion/tests/cmdline/svnrdump_tests.py

Propchange: subversion/branches/1.7.x/
------------------------------------------------------------------------------
  Merged /subversion/branches/1.7.x-issue4263:r1423588-1434547
  Merged /subversion/trunk:r1421011,1423585

Modified: subversion/branches/1.7.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/STATUS?rev=1434548&r1=1434547&r2=1434548&view=diff
==============================================================================
--- subversion/branches/1.7.x/STATUS (original)
+++ subversion/branches/1.7.x/STATUS Thu Jan 17 04:02:15 2013
@@ -180,16 +180,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * ^/subversion/branches/1.7.x-issue4263
-   Fix svnrdump inability to load dump files with non-LF line endings in
-   'svn:*' properties.
-   Justification:
-     Other tools have had this issue resolved, svnrdump should as well.
-   Branch:
-     ^/subversion/branches/1.7.x-issue4263
-   Votes:
-     +1: breser, danielsh, rhuijben
-
   * r1352031
     Change get-deps.sh to use zlib 1.2.7.
     Justification:

Modified: subversion/branches/1.7.x/subversion/svnrdump/load_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/svnrdump/load_editor.c?rev=1434548&r1=1434547&r2=1434548&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/svnrdump/load_editor.c (original)
+++ subversion/branches/1.7.x/subversion/svnrdump/load_editor.c Thu Jan 17 04:02:15 2013
@@ -729,6 +729,8 @@ set_revision_property(void *baton,
 {
   struct revision_baton *rb = baton;
 
+  SVN_ERR(svn_rdump__normalize_prop(name, &value, rb->pool));
+  
   SVN_ERR(svn_repos__validate_prop(name, value, rb->pool));
 
   if (rb->rev > 0)
@@ -808,6 +810,8 @@ set_node_property(void *baton,
         }
     }
 
+  SVN_ERR(svn_rdump__normalize_prop(name, &value, pool));
+
   SVN_ERR(svn_repos__validate_prop(name, value, pool));
 
   switch (nb->kind)

Modified: subversion/branches/1.7.x/subversion/svnrdump/svnrdump.h
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/svnrdump/svnrdump.h?rev=1434548&r1=1434547&r2=1434548&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/svnrdump/svnrdump.h (original)
+++ subversion/branches/1.7.x/subversion/svnrdump/svnrdump.h Thu Jan 17 04:02:15 2013
@@ -85,6 +85,20 @@ svn_rdump__normalize_props(apr_hash_t **
                            apr_hash_t *props,
                            apr_pool_t *result_pool);
 
+/* Normalize the line ending style of a single property that "needs
+ * translation" (according to svn_prop_needs_translation(),
+ * currently all svn:* props) so that they contain only LF (\n) line endings.
+ * "\r" characters found mid-line are replaced with "\n".
+ * "\r\n" sequences are replaced with "\n"
+ *
+ * NAME is used to check that VALUE should be normalized, and if this is the
+ * case, VALUE is then normalized, allocated from RESULT_POOL
+ */
+svn_error_t *
+svn_rdump__normalize_prop(const char *name,
+                          const svn_string_t **value,
+                          apr_pool_t *result_pool);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/branches/1.7.x/subversion/svnrdump/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/svnrdump/util.c?rev=1434548&r1=1434547&r2=1434548&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/svnrdump/util.c (original)
+++ subversion/branches/1.7.x/subversion/svnrdump/util.c Thu Jan 17 04:02:15 2013
@@ -31,6 +31,25 @@
 
 
 svn_error_t *
+svn_rdump__normalize_prop(const char *name,
+                          const svn_string_t **value,
+                          apr_pool_t *result_pool)
+{
+  if (svn_prop_needs_translation(name))
+    {
+      const char *cstring;
+
+      SVN_ERR(svn_subst_translate_cstring2((*value)->data, &cstring,
+                                           "\n", TRUE,
+                                           NULL, FALSE,
+                                           result_pool));
+
+      *value = svn_string_create(cstring, result_pool);
+    }
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
 svn_rdump__normalize_props(apr_hash_t **normal_props,
                            apr_hash_t *props,
                            apr_pool_t *result_pool)
@@ -45,16 +64,8 @@ svn_rdump__normalize_props(apr_hash_t **
       const char *key = svn__apr_hash_index_key(hi);
       const svn_string_t *value = svn__apr_hash_index_val(hi);
 
-      if (svn_prop_needs_translation(key))
-        {
-          const char *cstring;
-
-          SVN_ERR(svn_subst_translate_cstring2(value->data, &cstring,
-                                               "\n", TRUE,
-                                               NULL, FALSE,
-                                               result_pool));
-          value = svn_string_create(cstring, result_pool);
-        }
+      SVN_ERR(svn_rdump__normalize_prop(key, &value,
+                                        result_pool));
 
       apr_hash_set(*normal_props, key, APR_HASH_KEY_STRING, value);
     }

Modified: subversion/branches/1.7.x/subversion/tests/cmdline/svnrdump_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/tests/cmdline/svnrdump_tests.py?rev=1434548&r1=1434547&r2=1434548&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/tests/cmdline/svnrdump_tests.py (original)
+++ subversion/branches/1.7.x/subversion/tests/cmdline/svnrdump_tests.py Thu Jan 17 04:02:15 2013
@@ -375,6 +375,12 @@ def copy_bad_line_endings_dump(sbox):
                 expected_dumpfile_name="copy-bad-line-endings.expected.dump",
                 bypass_prop_validation=True)
 
+@Issue(4263)
+def copy_bad_line_endings_load(sbox):
+  "load: inconsistent line endings in svn:* props"
+  run_load_test(sbox, "copy-bad-line-endings.dump",
+                expected_dumpfile_name="copy-bad-line-endings.expected.dump")
+          
 @Skip(svntest.main.is_ra_type_dav_serf)
 def copy_bad_line_endings2_dump(sbox):
   "dump: non-LF line endings in svn:* props"
@@ -796,6 +802,7 @@ test_list = [ None,
               move_and_modify_in_the_same_revision_dump,
               move_and_modify_in_the_same_revision_load,
               copy_bad_line_endings_dump,
+              copy_bad_line_endings_load,
               copy_bad_line_endings2_dump,
               commit_a_copy_of_root_dump,
               commit_a_copy_of_root_load,