You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by bl...@apache.org on 2010/12/22 18:01:21 UTC

svn commit: r1051988 - /subversion/trunk/subversion/libsvn_repos/commit.c

Author: blair
Date: Wed Dec 22 17:01:20 2010
New Revision: 1051988

URL: http://svn.apache.org/viewvc?rev=1051988&view=rev
Log:
Improve error messages from svn_repos__post_commit_error_str().  Also,
improve docs.

Found by: danielsh

* subversion/libsvn_repos/commit.c
  (svn_repos__post_commit_error_str):
    Since this skips over SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED,
    include in all messages where the message is coming from,
    post-commit processing or post-commit hook.

Modified:
    subversion/trunk/subversion/libsvn_repos/commit.c

Modified: subversion/trunk/subversion/libsvn_repos/commit.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/commit.c?rev=1051988&r1=1051987&r2=1051988&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/commit.c (original)
+++ subversion/trunk/subversion/libsvn_repos/commit.c Wed Dec 22 17:01:20 2010
@@ -657,6 +657,10 @@ svn_repos__post_commit_error_str(svn_err
 
   err = svn_error_purge_tracing(err);
 
+  /* hook_err1 is the SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED wrapped
+     error from the post-commit script, if any, and hook_err2 should
+     be the original error, but be defensive and handle a case where
+     SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED doesn't wrap an error. */
   hook_err1 = svn_error_find_cause(err, SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED);
   if (hook_err1 && hook_err1->child)
     hook_err2 = hook_err1->child;
@@ -672,15 +676,15 @@ svn_repos__post_commit_error_str(svn_err
     {
       if (err == hook_err1)
         {
-          if (hook_err2->message)
-            msg = apr_pstrdup(pool, hook_err2->message);
-          else
-            msg = "(no error message)";
+          msg = apr_psprintf(pool,
+                             "Post-commit hook had error '%s'.",
+                             hook_err2->message ? hook_err2->message
+                                                : "(no error message)");
         }
       else
         {
           msg = apr_psprintf(pool,
-                             "Post commit processing had error and '%s' "
+                             "Post commit processing had error '%s' and "
                              "post-commit hook had error '%s'.",
                              err->message ? err->message
                                           : "(no error message)",
@@ -690,10 +694,10 @@ svn_repos__post_commit_error_str(svn_err
     }
   else
     {
-      if (err->message)
-        msg = apr_pstrdup(pool, err->message);
-      else
-        msg = "(no error message)";
+      msg = apr_psprintf(pool,
+                         "Post-commit processing had error '%s'.",
+                         hook_err2->message ? hook_err2->message
+                                            : "(no error message)");
     }
 
   /* Because svn_error_purge_tracing() was used on the input error,



Re: svn commit: r1051988 - /subversion/trunk/subversion/libsvn_repos/commit.c

Posted by Blair Zajac <bl...@orcaware.com>.
On 12/22/10 10:30 AM, Daniel Shahaf wrote:
> blair@apache.org wrote on Wed, Dec 22, 2010 at 17:01:21 -0000:
>> Author: blair
>> Date: Wed Dec 22 17:01:20 2010
>> New Revision: 1051988
>>
>> URL: http://svn.apache.org/viewvc?rev=1051988&view=rev
>> Log:
>> Improve error messages from svn_repos__post_commit_error_str().  Also,
>> improve docs.
>>
>> Found by: danielsh
>>
>> * subversion/libsvn_repos/commit.c
>>    (svn_repos__post_commit_error_str):
>>      Since this skips over SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED,
>>      include in all messages where the message is coming from,
>>      post-commit processing or post-commit hook.
>>
>> Modified:
>>      subversion/trunk/subversion/libsvn_repos/commit.c
>>
>> Modified: subversion/trunk/subversion/libsvn_repos/commit.c
>>     hook_err1 = svn_error_find_cause(err, SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED);
>>     if (hook_err1&&  hook_err1->child)
>>       hook_err2 = hook_err1->child;
>> @@ -672,15 +676,15 @@ svn_repos__post_commit_error_str(svn_err
>>       {
>>         if (err == hook_err1)
>>           {
>> -          if (hook_err2->message)
>> -            msg = apr_pstrdup(pool, hook_err2->message);
>> -          else
>> -            msg = "(no error message)";
>> +          msg = apr_psprintf(pool,
>> +                             "Post-commit hook had error '%s'.",
>> +                             hook_err2->message ? hook_err2->message
>> +                                                : "(no error message)");
>>           }
>>         else
>>           {
>>             msg = apr_psprintf(pool,
>> -                             "Post commit processing had error and '%s' "
>> +                             "Post commit processing had error '%s' and "
>>                                "post-commit hook had error '%s'.",
>
> These messages should be marked for translation?

Did those in r1052029.

Blair

Re: svn commit: r1051988 - /subversion/trunk/subversion/libsvn_repos/commit.c

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
blair@apache.org wrote on Wed, Dec 22, 2010 at 17:01:21 -0000:
> Author: blair
> Date: Wed Dec 22 17:01:20 2010
> New Revision: 1051988
> 
> URL: http://svn.apache.org/viewvc?rev=1051988&view=rev
> Log:
> Improve error messages from svn_repos__post_commit_error_str().  Also,
> improve docs.
> 
> Found by: danielsh
> 
> * subversion/libsvn_repos/commit.c
>   (svn_repos__post_commit_error_str):
>     Since this skips over SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED,
>     include in all messages where the message is coming from,
>     post-commit processing or post-commit hook.
> 
> Modified:
>     subversion/trunk/subversion/libsvn_repos/commit.c
> 
> Modified: subversion/trunk/subversion/libsvn_repos/commit.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/commit.c?rev=1051988&r1=1051987&r2=1051988&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_repos/commit.c (original)
> +++ subversion/trunk/subversion/libsvn_repos/commit.c Wed Dec 22 17:01:20 2010
> @@ -657,6 +657,10 @@ svn_repos__post_commit_error_str(svn_err
>  
>    err = svn_error_purge_tracing(err);
>  
> +  /* hook_err1 is the SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED wrapped
> +     error from the post-commit script, if any, and hook_err2 should
> +     be the original error, but be defensive and handle a case where
> +     SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED doesn't wrap an error. */

Thanks.

>    hook_err1 = svn_error_find_cause(err, SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED);
>    if (hook_err1 && hook_err1->child)
>      hook_err2 = hook_err1->child;
> @@ -672,15 +676,15 @@ svn_repos__post_commit_error_str(svn_err
>      {
>        if (err == hook_err1)
>          {
> -          if (hook_err2->message)
> -            msg = apr_pstrdup(pool, hook_err2->message);
> -          else
> -            msg = "(no error message)";
> +          msg = apr_psprintf(pool,
> +                             "Post-commit hook had error '%s'.",
> +                             hook_err2->message ? hook_err2->message
> +                                                : "(no error message)");
>          }
>        else
>          {
>            msg = apr_psprintf(pool,
> -                             "Post commit processing had error and '%s' "
> +                             "Post commit processing had error '%s' and "
>                               "post-commit hook had error '%s'.",

These messages should be marked for translation?

>                               err->message ? err->message
>                                            : "(no error message)",
> @@ -690,10 +694,10 @@ svn_repos__post_commit_error_str(svn_err
>      }
>    else
>      {
> -      if (err->message)
> -        msg = apr_pstrdup(pool, err->message);
> -      else
> -        msg = "(no error message)";
> +      msg = apr_psprintf(pool,
> +                         "Post-commit processing had error '%s'.",
> +                         hook_err2->message ? hook_err2->message
> +                                            : "(no error message)");
>      }
>  
>    /* Because svn_error_purge_tracing() was used on the input error,
> 
> 

Re: svn commit: r1051988 - /subversion/trunk/subversion/libsvn_repos/commit.c

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
blair@apache.org wrote on Wed, Dec 22, 2010 at 17:01:21 -0000:
> Author: blair
> Date: Wed Dec 22 17:01:20 2010
> New Revision: 1051988
> 
> URL: http://svn.apache.org/viewvc?rev=1051988&view=rev
> Log:
> Improve error messages from svn_repos__post_commit_error_str().  Also,
> improve docs.
> 
> Found by: danielsh
> 
> * subversion/libsvn_repos/commit.c
>   (svn_repos__post_commit_error_str):
>     Since this skips over SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED,
>     include in all messages where the message is coming from,
>     post-commit processing or post-commit hook.
> 
> Modified:
>     subversion/trunk/subversion/libsvn_repos/commit.c
> 
> Modified: subversion/trunk/subversion/libsvn_repos/commit.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/commit.c?rev=1051988&r1=1051987&r2=1051988&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_repos/commit.c (original)
> +++ subversion/trunk/subversion/libsvn_repos/commit.c Wed Dec 22 17:01:20 2010
> @@ -657,6 +657,10 @@ svn_repos__post_commit_error_str(svn_err
>  
>    err = svn_error_purge_tracing(err);
>  
> +  /* hook_err1 is the SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED wrapped
> +     error from the post-commit script, if any, and hook_err2 should
> +     be the original error, but be defensive and handle a case where
> +     SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED doesn't wrap an error. */

Thanks.

>    hook_err1 = svn_error_find_cause(err, SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED);
>    if (hook_err1 && hook_err1->child)
>      hook_err2 = hook_err1->child;
> @@ -672,15 +676,15 @@ svn_repos__post_commit_error_str(svn_err
>      {
>        if (err == hook_err1)
>          {
> -          if (hook_err2->message)
> -            msg = apr_pstrdup(pool, hook_err2->message);
> -          else
> -            msg = "(no error message)";
> +          msg = apr_psprintf(pool,
> +                             "Post-commit hook had error '%s'.",
> +                             hook_err2->message ? hook_err2->message
> +                                                : "(no error message)");
>          }
>        else
>          {
>            msg = apr_psprintf(pool,
> -                             "Post commit processing had error and '%s' "
> +                             "Post commit processing had error '%s' and "
>                               "post-commit hook had error '%s'.",

These messages should be marked for translation?

>                               err->message ? err->message
>                                            : "(no error message)",
> @@ -690,10 +694,10 @@ svn_repos__post_commit_error_str(svn_err
>      }
>    else
>      {
> -      if (err->message)
> -        msg = apr_pstrdup(pool, err->message);
> -      else
> -        msg = "(no error message)";
> +      msg = apr_psprintf(pool,
> +                         "Post-commit processing had error '%s'.",
> +                         hook_err2->message ? hook_err2->message
> +                                            : "(no error message)");
>      }
>  
>    /* Because svn_error_purge_tracing() was used on the input error,
> 
> 

Re: svn commit: r1051988 - /subversion/trunk/subversion/libsvn_repos/commit.c

Posted by Blair Zajac <bl...@orcaware.com>.
On 12/22/10 9:09 AM, Blair Zajac wrote:
> On 12/22/10 9:01 AM, blair@apache.org wrote:
>> Author: blair
>> Date: Wed Dec 22 17:01:20 2010
>> New Revision: 1051988
>>
>> URL: http://svn.apache.org/viewvc?rev=1051988&view=rev
>> Log:
>> Improve error messages from svn_repos__post_commit_error_str(). Also,
>> improve docs.
>
> I see the unit test failures from this commit, working on them now.

Fixed in r1052029.

Blair

Re: svn commit: r1051988 - /subversion/trunk/subversion/libsvn_repos/commit.c

Posted by Blair Zajac <bl...@orcaware.com>.
On 12/22/10 9:01 AM, blair@apache.org wrote:
> Author: blair
> Date: Wed Dec 22 17:01:20 2010
> New Revision: 1051988
>
> URL: http://svn.apache.org/viewvc?rev=1051988&view=rev
> Log:
> Improve error messages from svn_repos__post_commit_error_str().  Also,
> improve docs.

I see the unit test failures from this commit, working on them now.

Blair