Kevin Pilch-Bisson kevin@pilch-bisson.net writes:
We could do that, but I think we also decided that just using 3 or so of the
standard ones and documenting it would be fine as well.
NOTE: This is not a review of the patch below. I'll try to look at that next
week if no-one beats me to it.
Kevin, any progress on this? Feel free to punt, of course; if we know
you can't get to it, then someone else can review it, no problem.
By the way, agree that trying the standard three extensions is fine.
At least, let's get something working now; and if we want to make
backwards-compatible improvements to it later, that's fine :-).
(Oh, revision 4169 makes me wonder if Mike Pilato wasn't also working
on this... Mike?)
-K
-----Original Message-----
From: Chris Foote [mailto:Chris.Foote@xtra.co.nz]
Sent: Friday, January 10, 2003 9:56 PM
To: dev@subversion.tigris.org
Subject: [PATCH] run hook-scripts on WIN32
This patch, from rev 4328, gets the hooks working on WIN32 by
checking for a
script
with an .exe, .cmd or .bat extentsion.
Log:
Run hook programs on WIN32.
* hooks.c:
(check_hook_cmd): New function to check for the hook program.
(svn_repos__hooks_start_commit, svn_repos__hooks_pre_commit,
svn_repos__hooks_post_commit, svn_repos__hooks_pre_revprop_change,
svn_repos__hooks_post_revprop_change) : use check_hook_cmd.
Index: subversion/libsvn_repos/hooks.c
===================================================================
--- subversion/libsvn_repos/hooks.c (revision 4328)
+++ subversion/libsvn_repos/hooks.c (working copy)
@@ -27,6 +27,7 @@
#include svn_path.h
#include svn_delta.h
#include svn_fs.h
+#include svn_private_config.h /* for SVN_WIN32 */
#include svn_repos.h
#include repos.h
@@ -107,6 +108,40 @@
}
+/* Check if the HOOK program exists and is a file, using POOL for
+ temporary allocations. Returns the hook program if found,
+ otherwise NULL. */
+static const char*
+check_hook_cmd (const char *hook, apr_pool_t *pool)
+{
+ svn_node_kind_t kind;
+ const char* hook_path = hook;
+
+#ifdef SVN_WIN32
+ /* For WIN32 we need to check with an added extentsion(s). */
+ static const char* const check_extns[] = {
+ .exe, .cmd, .bat, /* ### Any other extentsions? */
+ NULL
+ };
+ const char* const * extn = check_extns;
+
+ while (*extn)
+ {
+ hook_path = apr_pstrcat (pool, hook, *(extn++), 0);
+#else
+ {
+#endif
+ if ((! svn_io_check_path(hook_path, kind, pool))
+ (kind == svn_node_file))
+ {
+ return hook_path;
+ }
+ }
+
+ return NULL;
+}
+
+
/* Run the start-commit hook for REPOS. Use POOL for any temporary
allocations. If the hook fails, return
SVN_ERR_REPOS_HOOK_FAILURE. */
svn_error_t *
@@ -114,11 +149,9 @@
const char *user,
apr_pool_t *pool)
{
- svn_node_kind_t kind;
const char *hook = svn_repos_start_commit_hook (repos, pool);
- if ((! svn_io_check_path (hook, kind, pool))
- (kind == svn_node_file))
+ if (hook = check_hook_cmd (hook, pool))
{
const char *args[4];
@@ -141,11 +174,9 @@
const char *txn_name,
apr_pool_t *pool)
{
- svn_node_kind_t kind;
const char *hook = svn_repos_pre_commit_hook (repos, pool);
- if ((! svn_io_check_path (hook, kind, pool))
- (kind == svn_node_file))
+ if (hook = check_hook_cmd (hook, pool))
{
const char *args[4];
@@ -168,11 +199,9 @@
svn_revnum_t rev,
apr_pool_t *pool)
{
- svn_node_kind_t kind;
const char *hook = svn_repos_post_commit_hook (repos, pool);
- if ((! svn_io_check_path (hook, kind, pool))
- (kind == svn_node_file))
+ if (hook = check_hook_cmd (hook, pool))
{
const char *args[4];
@@ -199,11 +228,9 @@
const svn_string_t *value,
apr_pool_t *pool)
{
- svn_node_kind_t kind;
const char *hook = svn_repos_pre_revprop_change_hook (repos, pool);
- if ((! svn_io_check_path (hook, kind, pool))
- (kind == svn_node_file))
+ if (hook = check_hook_cmd (hook, pool))
{
const char *args[6];
@@ -245,11 +272,9 @@
const char *name,
apr_pool_t *pool)
{
- svn_node_kind_t kind;
const char *hook = svn_repos_post_revprop_change_hook
(repos, pool);
- if ((! svn_io_check_path (hook, kind, pool))
- (kind == svn_node_file))
+ if (hook = check_hook_cmd (hook, pool))
{
const char *args[6];
---------------------------------------------------------------------
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
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kevin Pilch-Bisson http://www.pilch-bisson.net
Historically speaking, the presences of wheels in Unix
has never precluded their reinvention. - Larry Wall
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 14 02:11:17 2006