[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] hook failure messages

From: Eric Gillespie <epg_at_pretzelnet.org>
Date: 2007-12-06 04:47:25 CET

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
Received on Thu Dec 6 04:47:36 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.