You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Tom Gordon <tg...@motricity.com> on 2005/09/27 15:52:23 UTC

[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: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org