You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Eric Gillespie <ep...@pretzelnet.org> on 2007/12/06 03:47:25 UTC

[PATCH] hook failure messages

The hook failure message has always annoyed me.  How about this?
(I'm sure some tests need updating, but I didn't want to get too
deep if this gets -1'd)

TODAY:
Transmitting file data .svn: Commit failed (details follow):
svn: MERGE request failed on '/test/ops'
svn: 'pre-commit' hook failed (exited with a non-zero exitcode of 1).  The follo
wing error output was produced by the hook:

PROPOSED:
Transmitting file data .svn: Commit failed (details follow):
svn: MERGE request failed on '/test/ops'
svn: commit blocked (exit code 1) with output:

--- subversion/libsvn_repos/hooks.c.orig        2007-11-08 20:14:34.000000000 +0000
+++ subversion/libsvn_repos/hooks.c     2007-12-06 00:42:12.000000000 +0000
@@ -119,23 +119,38 @@
     }
   else
     {
-      failure_message = svn_stringbuf_createf(pool,
-        _("'%s' hook failed (exited with a non-zero exitcode of %d).  "),
-        name, exitcode);
+      char *action;
+      if (strcmp(name, "start-commit") == 0
+          || strcmp(name, "pre-commit") == 0)
+        action = "commit";
+      else if (strcmp(name, "pre-revprop-change") == 0)
+        action = "Revprop change";
+      else if (strcmp(name, "pre-lock") == 0)
+        action = "Lock";
+      else if (strcmp(name, "pre-unlock") == 0)
+        action = "Unlock";
+      else
+        action = NULL;
+      if (action == NULL)
+        failure_message = svn_stringbuf_createf(pool,
+                                            _("%s hook failed (exit code %d)"),
+                                                name, exitcode);
+      else
+        failure_message = svn_stringbuf_createf(pool,
+                                                _("%s blocked (exit code %d)"),
+                                                action, exitcode);
     }
 
   if (utf8_stderr[0])
     {
       svn_stringbuf_appendcstr(failure_message,
-                               _("The following error output was produced "
-                                 "by the hook:\n"));
+                               _(" with output:\n"));
       svn_stringbuf_appendcstr(failure_message, utf8_stderr);
     }
   else
     {
       svn_stringbuf_appendcstr(failure_message,
-                               _("No error output was produced by the "
-                                 "hook."));
+                               _(" with no output."));
     }
 
   return svn_error_create(SVN_ERR_REPOS_HOOK_FAILURE, err,

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] hook failure messages

Posted by "C. Michael Pilato" <cm...@collab.net>.
Eric Gillespie wrote:
> The hook failure message has always annoyed me.  How about this?
> (I'm sure some tests need updating, but I didn't want to get too
> deep if this gets -1'd)
> 
> TODAY:
> Transmitting file data .svn: Commit failed (details follow):
> svn: MERGE request failed on '/test/ops'
> svn: 'pre-commit' hook failed (exited with a non-zero exitcode of 1).  The follo
> wing error output was produced by the hook:
> 
> PROPOSED:
> Transmitting file data .svn: Commit failed (details follow):
> svn: MERGE request failed on '/test/ops'
> svn: commit blocked (exit code 1) with output:

Not a big fan of this change -- I like seeing the hook name (though I find
it silly that it is quoted).  And the commit wasn't blocked by the output,
which might be how someone interprets "commit blocked with output:".

How about one of these:

   svn: commit blocked by exit code 1 from pre-commit hook, with output:
   svn: commit blocked by pre-commit hook (exit code 1) with output:

?

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand


Re: [PATCH] hook failure messages

Posted by Eric Gillespie <ep...@pretzelnet.org>.
"C. Michael Pilato" <cm...@collab.net> writes:

> Not a big fan of this change -- I like seeing the hook name
> (though I find it silly that it is quoted).  And the commit
> wasn't blocked by the output, which might be how someone
> interprets "commit blocked with output:".

Well, you're a fan of the idea, I guess, which is what counts :)

> How about one of these:
> 
>    svn: commit blocked by exit code 1 from pre-commit hook, with output:
>    svn: commit blocked by pre-commit hook (exit code 1) with output:

I'll take the second one.

Karl Fogel <kf...@red-bean.com> writes:

> Regarding the second line: can we get rid of it?  Does any user really
> need to see the words "MERGE request" in the context of a commit? :-)

That's an old argument; I stopped complaining ages ago.  ra-neon
is always spewing the HTTP request to the user, baffling everyone.
I suppose serf is the same, not sure.

-- 
Eric Gillespie <*> epg@pretzelnet.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] hook failure messages

Posted by Karl Fogel <kf...@red-bean.com>.
Eric Gillespie <ep...@pretzelnet.org> writes:
> TODAY:
> Transmitting file data .svn: Commit failed (details follow):
> svn: MERGE request failed on '/test/ops'
> svn: 'pre-commit' hook failed (exited with a non-zero exitcode of 1).  The follo
> wing error output was produced by the hook:
>
> PROPOSED:
> Transmitting file data .svn: Commit failed (details follow):
> svn: MERGE request failed on '/test/ops'
> svn: commit blocked (exit code 1) with output:

Mike's already weighed on on the last line (I agree with him).

Regarding the second line: can we get rid of it?  Does any user really
need to see the words "MERGE request" in the context of a commit? :-)

-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org