The standard solution to this problem is to make 'svn commit' use a
server-defined log-message template, one which has custom fields of
your choice. Then you can install a pre-commit hook which demands
that all the fields are filled out in the log-message (else the commit
is rejected.)
Enforcement pre-commit hook is certainly doable right now, but we're
still discussing a design for broadcasting log-message templates.
You'll need to find some other workaround for that -- either educate
the developers (make them remember the string), or pass out templates
by hand for folks to use. Also, remember that the pre-commit hook can
reject the commit with a specific error message:
"Commit rejected: I didn't find a 'Bug ID:' field in the log message."
That will certainly remind the developer exactly which string to use.
On 9/28/05, Tom Gordon <tgordon@motricity.com> wrote:
> I posted the enclosed message to the users group list to no avail.
> Please let me know if this is better suited for the Dev list.
>
> Thanks,
>
> Tom Gordon
>
>
>
> ---------- Forwarded message ----------
> From: Tom Gordon <tgordon@motricity.com>
> To: users@subversion.tigris.org
> Date: Tue, 27 Sep 2005 11:52:23 -0400
> Subject: [Patch] prompt string for client
> All,
>
> I searched the mail archives and couldn't find what I was looking for,
> so I created a "patch" to exemplify what I would like to do.
>
> I would like to prompt the user to enter a Bug Id and who reviewed the
> code on the client, before sending the commit to the server. I can
> easily enough add a pre-commit hook to ensure that the user did enter
> the string, but it seems silly for all the developers to have to
> remember the "string" to pass in.
>
> Is there a better way to implement this behavior?
>
>
> Thanks,
>
> Tom Gordon
>
>
> Here's a patch to cause the client to send the string
> (subversion-1.2.3/subversion/clients/cmdline/util.c):
>
> @@ -433,6 +433,7 @@
>
>
> #define EDITOR_EOF_PREFIX _("--This line, and those below, will be
> ignored--")
> +#define DEFAULT_COMMIT_MSG _("Bug Id: Reviewed By: ")
>
> /* This function is of type svn_client_get_commit_log_t. */
> svn_error_t *
> @@ -445,9 +446,19 @@
> svn_stringbuf_t *default_msg = NULL;
> struct log_msg_baton *lmb = baton;
> svn_stringbuf_t *message = NULL;
> + const char *required_msg = NULL;
>
> /* Set default message. */
> - default_msg = svn_stringbuf_create(APR_EOL_STR, pool);
> + required_msg = getenv ("COMMIT_REQUIRED_MSG");
> + if (required_msg)
> + {
> + default_msg = svn_stringbuf_create(required_msg, pool);
> + svn_stringbuf_appendcstr(default_msg, APR_EOL_STR APR_EOL_STR);
> + }
> + else {
> + default_msg = svn_stringbuf_create(DEFAULT_COMMIT_MSG, pool);
> + svn_stringbuf_appendcstr(default_msg, APR_EOL_STR APR_EOL_STR);
> + }
> svn_stringbuf_appendcstr(default_msg, EDITOR_EOF_PREFIX);
> svn_stringbuf_appendcstr(default_msg, APR_EOL_STR APR_EOL_STR);
>
>
> note: this code has an environment override of the default message
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Sep 28 15:54:54 2005