subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r1070892 - in /subversion/trunk/subversion: libsvn_fs_base/ libsvn_fs_fs/ libsvn_repos/ libsvn_wc/ tests/cmdline/
Date Tue, 15 Feb 2011 13:43:22 GMT
Author: hwright
Date: Tue Feb 15 13:43:20 2011
New Revision: 1070892

URL: http://svn.apache.org/viewvc?rev=1070892&view=rev
Log:
Make more extensive use of svn_checksum_mismatch_err().  In addition to
improving code reuse, this has the benefit of reducing the amount of translator
effort and eliminating a number of "format is not a string literal" warnings.

* subversion/libsvn_fs_base/tree.c
  (txn_body_apply_textdelta),
  subversion/libsvn_fs_base/reps-strings.c
  (svn_fs_base__rep_contents, txn_body_read_rep),
  subversion/libsvn_fs_base/dag.c
  (svn_fs_base__dag_finalize_edits),
  subversion/libsvn_wc/update_editor.c
  (close_file),
  subversion/libsvn_wc/questions.c
  (compare_and_verify),
  subversion/libsvn_wc/adm_crawler.c
  (svn_wc__internal_transmit_text_deltas),
  subversion/libsvn_repos/load-fs-vtable.c
  (maybe_add_with_history),
  subversion/libsvn_repos/commit.c
  (close_file),
  subversion/libsvn_fs_fs/tree.c
  (apply_textdelta),
  subversion/libsvn_fs_fs/fs_fs.c
  (rep_read_contents),
  subversion/libsvn_fs_fs/dag.c
  (svn_fs_fs__dag_finalize_edits):
    Use svn_checksum_mismatch_err() where appropriate.

* subversion/tests/cmdline/basic_tests.py
  (basic_corruption): Update expected error code.

Modified:
    subversion/trunk/subversion/libsvn_fs_base/dag.c
    subversion/trunk/subversion/libsvn_fs_base/reps-strings.c
    subversion/trunk/subversion/libsvn_fs_base/tree.c
    subversion/trunk/subversion/libsvn_fs_fs/dag.c
    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
    subversion/trunk/subversion/libsvn_fs_fs/tree.c
    subversion/trunk/subversion/libsvn_repos/commit.c
    subversion/trunk/subversion/libsvn_repos/load-fs-vtable.c
    subversion/trunk/subversion/libsvn_wc/adm_crawler.c
    subversion/trunk/subversion/libsvn_wc/questions.c
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/tests/cmdline/basic_tests.py

Modified: subversion/trunk/subversion/libsvn_fs_base/dag.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_base/dag.c?rev=1070892&r1=1070891&r2=1070892&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_base/dag.c (original)
+++ subversion/trunk/subversion/libsvn_fs_base/dag.c Tue Feb 15 13:43:20 2011
@@ -1275,15 +1275,9 @@ svn_fs_base__dag_finalize_edits(dag_node
         return svn_error_create(SVN_ERR_BAD_CHECKSUM_KIND, NULL, NULL);
 
       if (! svn_checksum_match(checksum, test_checksum))
-        return svn_error_createf
-          (SVN_ERR_CHECKSUM_MISMATCH, NULL,
-           apr_psprintf(pool, "%s:\n%s\n%s\n",
+        return svn_checksum_mismatch_err(checksum, test_checksum, pool,
                         _("Checksum mismatch on representation '%s'"),
-                        _("   expected:  %s"),
-                        _("     actual:  %s")),
-           noderev->edit_key,
-           svn_checksum_to_cstring_display(checksum, pool),
-           svn_checksum_to_cstring_display(test_checksum, pool));
+                        noderev->edit_key);
     }
 
   /* Now, we want to delete the old representation and replace it with

Modified: subversion/trunk/subversion/libsvn_fs_base/reps-strings.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_base/reps-strings.c?rev=1070892&r1=1070891&r2=1070892&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_base/reps-strings.c (original)
+++ subversion/trunk/subversion/libsvn_fs_base/reps-strings.c Tue Feb 15 13:43:20 2011
@@ -823,15 +823,11 @@ svn_fs_base__rep_contents(svn_string_t *
                          pool));
 
     if (! svn_checksum_match(checksum, rep_checksum))
-      return svn_error_createf
-        (SVN_ERR_FS_CORRUPT, NULL,
-         apr_psprintf(pool, "%s:\n%s\n%s\n",
-                      _("Checksum mismatch on representation '%s'"),
-                      _("   expected:  %s"),
-                      _("     actual:  %s")),
-         rep_key,
-         svn_checksum_to_cstring_display(rep_checksum, pool),
-         svn_checksum_to_cstring_display(checksum, pool));
+      return svn_error_create(SVN_ERR_FS_CORRUPT,
+                svn_checksum_mismatch_err(rep_checksum, checksum, pool,
+                            _("Checksum mismatch on representation '%s'"),
+                            rep_key),
+                NULL);
   }
 
   return SVN_NO_ERROR;
@@ -921,32 +917,22 @@ txn_body_read_rep(void *baton, trail_t *
               if (rep->md5_checksum
                   && (! svn_checksum_match(rep->md5_checksum,
                                            args->rb->md5_checksum)))
-                return svn_error_createf
-                  (SVN_ERR_FS_CORRUPT, NULL,
-                   apr_psprintf(trail->pool, "%s:\n%s\n%s\n",
-                                _("MD5 checksum mismatch on representation '%s'"),
-                                _("   expected:  %s"),
-                                _("     actual:  %s")),
-                   args->rb->rep_key,
-                   svn_checksum_to_cstring_display(rep->md5_checksum,
-                                                   trail->pool),
-                   svn_checksum_to_cstring_display(args->rb->md5_checksum,
-                                                   trail->pool));
+                return svn_error_create(SVN_ERR_FS_CORRUPT,
+                        svn_checksum_mismatch_err(rep->md5_checksum,
+                             args->rb->sha1_checksum, trail->pool,
+                             _("MD5 checksum mismatch on representation '%s'"),
+                             args->rb->rep_key),
+                        NULL);
 
               if (rep->sha1_checksum
                   && (! svn_checksum_match(rep->sha1_checksum,
                                            args->rb->sha1_checksum)))
-                return svn_error_createf
-                  (SVN_ERR_FS_CORRUPT, NULL,
-                   apr_psprintf(trail->pool, "%s:\n%s\n%s\n",
-                                _("SHA1 checksum mismatch on representation '%s'"),
-                                _("   expected:  %s"),
-                                _("     actual:  %s")),
-                   args->rb->rep_key,
-                   svn_checksum_to_cstring_display(rep->sha1_checksum,
-                                                   trail->pool),
-                   svn_checksum_to_cstring_display(args->rb->sha1_checksum,
-                                                   trail->pool));
+                return svn_error_createf(SVN_ERR_FS_CORRUPT,
+                        svn_checksum_mismatch_err(rep->sha1_checksum,
+                            args->rb->sha1_checksum, trail->pool,
+                            _("SHA1 checksum mismatch on representation '%s'"),
+                            args->rb->rep_key),
+                        NULL);
             }
         }
     }

Modified: subversion/trunk/subversion/libsvn_fs_base/tree.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_base/tree.c?rev=1070892&r1=1070891&r2=1070892&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_base/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_base/tree.c Tue Feb 15 13:43:20 2011
@@ -3875,16 +3875,10 @@ txn_body_apply_textdelta(void *baton, tr
          check could be more comprehensive? */
       if (tb->base_checksum->kind == checksum->kind
             && !svn_checksum_match(tb->base_checksum, checksum))
-        return svn_error_createf
-          (SVN_ERR_CHECKSUM_MISMATCH,
-           NULL,
-           apr_psprintf(trail->pool, "%s:\n%s\n%s\n",
-                        _("Base checksum mismatch on '%s'"),
-                        _("   expected:  %s"),
-                        _("     actual:  %s")),
-           tb->path,
-           svn_checksum_to_cstring_display(tb->base_checksum, trail->pool),
-           svn_checksum_to_cstring_display(checksum, trail->pool));
+        return svn_checksum_mismatch_err(tb->base_checksum, checksum,
+                            trail->pool,
+                            _("Base checksum mismatch on '%s'"),
+                            tb->path);
     }
 
   /* Make a readable "source" stream out of the current contents of

Modified: subversion/trunk/subversion/libsvn_fs_fs/dag.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/dag.c?rev=1070892&r1=1070891&r2=1070892&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/dag.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/dag.c Tue Feb 15 13:43:20 2011
@@ -1022,16 +1022,9 @@ svn_fs_fs__dag_finalize_edits(dag_node_t
       SVN_ERR(svn_fs_fs__dag_file_checksum(&file_checksum, file,
                                            checksum->kind, pool));
       if (!svn_checksum_match(checksum, file_checksum))
-        return svn_error_createf(SVN_ERR_CHECKSUM_MISMATCH, NULL,
-                                 apr_psprintf(pool, "%s:\n%s\n%s\n",
-                                              _("Checksum mismatch for '%s'"),
-                                              _("   expected:  %s"),
-                                              _("     actual:  %s")),
-                                 file->created_path,
-                                 svn_checksum_to_cstring_display(checksum,
-                                                                 pool),
-                                 svn_checksum_to_cstring_display(file_checksum,
-                                                                 pool));
+        return svn_checksum_mismatch_err(checksum, file_checksum, pool,
+                                         _("Checksum mismatch for '%s'"),
+                                         file->created_path);
     }
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1070892&r1=1070891&r2=1070892&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Tue Feb 15 13:43:20 2011
@@ -3494,14 +3494,11 @@ rep_read_contents(void *baton,
           SVN_ERR(svn_checksum_final(&md5_checksum, rb->md5_checksum_ctx,
                                      rb->pool));
           if (!svn_checksum_match(md5_checksum, rb->md5_checksum))
-            return svn_error_createf
-              (SVN_ERR_FS_CORRUPT, NULL,
-               apr_psprintf(rb->pool, "%s:\n%s\n%s\n",
-                            _("Checksum mismatch while reading representation"),
-                            _("   expected:  %s"),
-                            _("     actual:  %s")),
-               svn_checksum_to_cstring_display(rb->md5_checksum, rb->pool),
-               svn_checksum_to_cstring_display(md5_checksum, rb->pool));
+            return svn_error_create(SVN_ERR_FS_CORRUPT,
+                    svn_checksum_mismatch_err(rb->md5_checksum, md5_checksum,
+                        rb->pool,
+                        _("Checksum mismatch while reading representation")),
+                    NULL);
         }
     }
 

Modified: subversion/trunk/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/tree.c?rev=1070892&r1=1070891&r2=1070892&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/tree.c Tue Feb 15 13:43:20 2011
@@ -2454,16 +2454,9 @@ apply_textdelta(void *baton, apr_pool_t 
       SVN_ERR(svn_fs_fs__dag_file_checksum(&checksum, tb->node,
                                            tb->base_checksum->kind, pool));
       if (!svn_checksum_match(tb->base_checksum, checksum))
-        return svn_error_createf
-          (SVN_ERR_CHECKSUM_MISMATCH,
-           NULL,
-           apr_psprintf(pool, "%s:\n%s\n%s\n",
-                        _("Base checksum mismatch on '%s'"),
-                        _("   expected:  %s"),
-                        _("     actual:  %s")),
-           tb->path,
-           svn_checksum_to_cstring_display(tb->base_checksum, pool),
-           svn_checksum_to_cstring_display(checksum, pool));
+        return svn_checksum_mismatch_err(tb->base_checksum, checksum, pool,
+                                         _("Base checksum mismatch on '%s'"),
+                                         tb->path);
     }
 
   /* Make a readable "source" stream out of the current contents of

Modified: subversion/trunk/subversion/libsvn_repos/commit.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/commit.c?rev=1070892&r1=1070891&r2=1070892&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/commit.c (original)
+++ subversion/trunk/subversion/libsvn_repos/commit.c Tue Feb 15 13:43:20 2011
@@ -568,16 +568,9 @@ close_file(void *file_baton,
                                      text_digest, pool));
 
       if (!svn_checksum_match(text_checksum, checksum))
-        {
-          return svn_error_createf
-            (SVN_ERR_CHECKSUM_MISMATCH, NULL,
-             apr_psprintf(pool, "%s:\n%s\n%s\n",
-                          _("Checksum mismatch for resulting fulltext\n(%s)"),
-                          _("   expected:  %s"),
-                          _("     actual:  %s")),
-             fb->path, svn_checksum_to_cstring_display(text_checksum, pool),
-             svn_checksum_to_cstring_display(checksum, pool));
-        }
+        return svn_checksum_mismatch_err(text_checksum, checksum, pool,
+                            _("Checksum mismatch for resulting fulltext\n(%s)"),
+                            fb->path);
     }
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/libsvn_repos/load-fs-vtable.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/load-fs-vtable.c?rev=1070892&r1=1070891&r2=1070892&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/load-fs-vtable.c (original)
+++ subversion/trunk/subversion/libsvn_repos/load-fs-vtable.c Tue Feb 15 13:43:20 2011
@@ -516,18 +516,11 @@ maybe_add_with_history(struct node_baton
           SVN_ERR(svn_fs_file_checksum(&checksum, svn_checksum_md5, copy_root,
                                        nb->copyfrom_path, TRUE, pool));
           if (!svn_checksum_match(nb->copy_source_checksum, checksum))
-            return svn_error_createf
-              (SVN_ERR_CHECKSUM_MISMATCH,
-               NULL,
-               apr_psprintf(pool, "%s:\n%s\n%s\n",
-                            _("Copy source checksum mismatch on copy from '%s'@%ld\n"
-                              "to '%s' in rev based on r%ld"),
-                            _("   expected:  %s"),
-                            _("     actual:  %s")),
-               nb->copyfrom_path, src_rev,
-               nb->path, rb->rev,
-               svn_checksum_to_cstring_display(nb->copy_source_checksum, pool),
-               svn_checksum_to_cstring_display(checksum, pool));
+            return svn_checksum_mismatch_err(nb->copy_source_checksum,
+                      checksum, pool,
+                      _("Copy source checksum mismatch on copy from '%s'@%ld\n"
+                        "to '%s' in rev based on r%ld"),
+                      nb->copyfrom_path, src_rev, nb->path, rb->rev);
         }
 
       SVN_ERR(svn_fs_copy(copy_root, nb->copyfrom_path,

Modified: subversion/trunk/subversion/libsvn_wc/adm_crawler.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_crawler.c?rev=1070892&r1=1070891&r2=1070892&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_crawler.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_crawler.c Tue Feb 15 13:43:20 2011
@@ -1260,16 +1260,13 @@ svn_wc__internal_transmit_text_deltas(co
       if (tempfile)
         svn_error_clear(svn_io_remove_file2(*tempfile, TRUE, scratch_pool));
 
-      return svn_error_createf(SVN_ERR_WC_CORRUPT_TEXT_BASE, NULL,
-                               _("Checksum mismatch for text base of '%s':\n"
-                                 "   expected:  %s\n"
-                                 "     actual:  %s\n"),
-                               svn_dirent_local_style(local_abspath,
-                                                      scratch_pool),
-                               svn_checksum_to_cstring_display(
-                                 expected_md5_checksum, scratch_pool),
-                               svn_checksum_to_cstring_display(
-                                 verify_checksum, scratch_pool));
+      return svn_error_create(SVN_ERR_WC_CORRUPT_TEXT_BASE,
+            svn_checksum_mismatch_err(expected_md5_checksum, verify_checksum,
+                            scratch_pool,
+                            _("Checksum mismatch for text base of '%s'"),
+                            svn_dirent_local_style(local_abspath,
+                                                   scratch_pool)),
+            NULL);
     }
 
   /* Now, handle that delta transmission error if any, so we can stop

Modified: subversion/trunk/subversion/libsvn_wc/questions.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/questions.c?rev=1070892&r1=1070891&r2=1070892&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/questions.c (original)
+++ subversion/trunk/subversion/libsvn_wc/questions.c Tue Feb 15 13:43:20 2011
@@ -198,16 +198,14 @@ compare_and_verify(svn_boolean_t *modifi
       if (verify_checksum && node_checksum)
         {
           if (checksum && !svn_checksum_match(checksum, node_checksum))
-            {
-              return svn_error_createf(SVN_ERR_WC_CORRUPT_TEXT_BASE, NULL,
-                   _("Checksum mismatch indicates corrupt text base for file: "
-                     "'%s':\n"
-                     "   expected:  %s\n"
-                     "     actual:  %s\n"),
-                  svn_dirent_local_style(versioned_file_abspath, scratch_pool),
-                  svn_checksum_to_cstring_display(node_checksum, scratch_pool),
-                  svn_checksum_to_cstring_display(checksum, scratch_pool));
-            }
+            return svn_error_create(SVN_ERR_WC_CORRUPT_TEXT_BASE,
+                    svn_checksum_mismatch_err(node_checksum, checksum,
+                                              scratch_pool,
+                                _("Checksum mismatch indicates corrupt "
+                                  "text base for file: '%s'"),
+                                svn_dirent_local_style(versioned_file_abspath,
+                                                       scratch_pool)),
+                    NULL);
         }
     }
   else

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1070892&r1=1070891&r2=1070892&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Tue Feb 15 13:43:20 2011
@@ -4046,14 +4046,10 @@ close_file(void *file_baton,
   if (fb->new_text_base_md5_checksum && expected_md5_checksum
       && !svn_checksum_match(expected_md5_checksum,
                              fb->new_text_base_md5_checksum))
-    return svn_error_createf(SVN_ERR_CHECKSUM_MISMATCH, NULL,
-            _("Checksum mismatch for '%s':\n"
-              "   expected:  %s\n"
-              "     actual:  %s\n"),
-            svn_dirent_local_style(fb->local_abspath, pool),
-            expected_md5_digest,
-            svn_checksum_to_cstring_display(fb->new_text_base_md5_checksum,
-                                            pool));
+    return svn_checksum_mismatch_err(expected_md5_checksum,
+                            fb->new_text_base_md5_checksum, pool,
+                            _("Checksum mismatch for '%s'"),
+                            svn_dirent_local_style(fb->local_abspath, pool));
 
   SVN_ERR(svn_wc_read_kind(&kind, eb->wc_ctx, fb->local_abspath, TRUE, pool));
   if (kind == svn_node_none && ! fb->adding_file)

Modified: subversion/trunk/subversion/tests/cmdline/basic_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/basic_tests.py?rev=1070892&r1=1070891&r2=1070892&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/basic_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/basic_tests.py Tue Feb 15 13:43:20 2011
@@ -400,7 +400,7 @@ def basic_corruption(sbox):
   # This commit should fail due to text base corruption.
   svntest.actions.run_and_verify_commit(wc_dir, expected_output,
                                         expected_status,
-                                        "svn: E155017: Checksum",
+                                        "svn: E200014: Checksum",
                                         wc_dir)
 
   # Restore the uncorrupted text base.



Mime
View raw message