[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_at_pilch-bisson.net>
Date: 2003-01-23 21:49:31 CET

On Thu, Jan 23, 2003 at 07:31:13PM -0600, Karl Fogel wrote:
 Karl Fogel wrote:
  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, it appears Chris posted a new patch later, with some
 modifications suggested by Brane. However, his repost seems not to be
 available in the mailing list archives, I don't know why. This is the
 thread that it doesn't appear in:
 
 http://subversion.tigris.org/servlets/BrowseList?list=devby=threadfrom=77287
 
 ...and, since you won't find it there, below is the post itself :-).

Doh, I guess I had a stack overflow. Too much stuff piled up this week. I'll
look at it in the morning I promise.
 
 -K
 
  From: Chris Foote Chris.Foote@xtra.co.nz
  Subject: [PATCH] Update: run hook-scripts on WIN32
  To: dev@subversion.tigris.org
  Date: Sun, 12 Jan 2003 22:50:52 -0000
  
  Update to include Brane's suggestion.
  
  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 4359)
  +++ 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,38 @@
   }
   
   
  +/* 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)
  +{
  + static const char* const check_extns[] = {
  +#ifdef SVN_WIN32
  + /* For WIN32 we need to check with an added extentsion(s). */
  + .exe, .cmd, .bat, /* ### Any other extentsions? */
  +#else
  + ,
  +#endif
  + NULL
  + };
  +
  + const char *const *extn;
  + for (extn = check_extns; *extn; ++extn)
  + {
  + const char *const hook_path =
  + (**extn ? apr_pstrcat (pool, hook, *extn, 0) : hook);
  +
  + svn_node_kind_t kind;
  + 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 +147,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 +172,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 +197,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 +226,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 +270,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

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 Oct 14 02:12:11 2006

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.