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

Re: [PATCH] run hook-scripts on WIN32

From: Kevin Pilch-Bisson <kevin_at_pilch-bisson.net>
Date: 2003-01-10 22:01:14 CET

On Fri, Jan 10, 2003 at 10:25:48PM -0500, Smith, Eric V. wrote:
> You might want to look in the environment variable PATHEXT, or the
> registry setting
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
> Manager\Environment\PATHEXT for the list of executable extensions. On
> my box it's:
> .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH

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.
>
>
> > -----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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  • application/pgp-signature attachment: stored
Received on Sat Jan 11 05:02:49 2003

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.