You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by kf...@collab.net on 2001/09/24 14:37:15 UTC

Re: svn commit: revision 135 - trunk/subversion/include trunk/subversion/libsvn_wc trunk/subversion/libsvn_subr trunk/subversion/svnlook trunk/subversion/mod_dav_svn trunk/subversion/clients/cmdline trunk/subversion/libsvn_repos

kevin@tigris.org writes:
> Log:
> Get pre-commit hooks working.

Oh, yesssssssssss.  Thank you Kevin!

-K

>     * include/svn_io.h:svn_io_run_cmd - Add status argument, for the exit code
>     for the cmd.
> 
>     * libsvn_subr/io.c:svn_io_run_cmd - Pass status argument to apr_proc_wait
>     to get the exit code for the cmd.
> 
>     * libsvn_wc/log.c: - Pass a status argument to svn_io_run_cmd, note that
>     we could check the exit code.
> 
>     * svnlook/main.c:print_diff_tree - Pass a status argument to
>     svn_io_run_cmd, note that we could check the exit code.
> 
>     * mod_dav_svn/version.c:dav_svn_merge - Call svn_fs_abort_txn if we can't
>     commit.
> 
>     * cmdline/diff.c:svn_cl__print_file_diff - Pass a status argument to
>     svn_io_run_cmd, note that we could check the exit code.
> 
>     * libsvn_repos/hooks.c:run_cmd_with_output - Add status argument. All
>     callers changed.  
> 
>     * libsvn_repos/hooks.c:run_start_commit_hook, run_pre_commit_hook,
>     run_post_commit_hook - Change 'kind != svn_node_dir' to 'kind ==
>     svn_node_file', since kind is svn_node_none if the file doesn't exist.
> 
>     * libsvn_repos/hooks.c:run_pre_commit_hook - If the status of the
>     pre-commit hook was non-zero, return an error.
> 
>     * libsvn_repos/hooks.c:svn_repos_fs_commit_txn - Don't abort the txn if
>     the pre-commit hook fails, that is the caller's responsibility.
> 
> 
> Modified: trunk/subversion/include/svn_io.h
> ==============================================================================
> --- OLD/trunk/subversion/include/svn_io.h	Fri Sep 21 14:25:12 2001
> +++ NEW/trunk/subversion/include/svn_io.h	Fri Sep 21 14:25:12 2001
> @@ -259,12 +259,15 @@
>  /* Invoke PROGRAM with ARGS, using PATH as working directory.
>     Connect PROGRAM's stdin, stdout, and stderr to INFILE, OUTFILE, and
>     ERRFILE, except where they are null.
> +
> +   STATUS will contain the exit code of the process upon return.
>    
>     ARGS is a list of (const char *)'s, terminated by NULL.  ARGS[0] is
>     the name of the program, though it need not be the same as CMD.  */
>  svn_error_t *svn_io_run_cmd (const char *path,
>                               const char *cmd,
>                               const char *const *args,
> +                             apr_wait_t *status,
>                               apr_file_t *infile,
>                               apr_file_t *outfile,
>                               apr_file_t *errfile,
> 
> Modified: trunk/subversion/libsvn_wc/log.c
> ==============================================================================
> --- OLD/trunk/subversion/libsvn_wc/log.c	Fri Sep 21 14:25:12 2001
> +++ NEW/trunk/subversion/libsvn_wc/log.c	Fri Sep 21 14:25:12 2001
> @@ -142,6 +142,7 @@
>  {
>    svn_error_t *err;
>    apr_status_t apr_err;
> +  apr_wait_t status;
>    const char
>      *infile_name,
>      *outfile_name,
> @@ -218,12 +219,14 @@
>                                    "error opening %s", errfile_path->data);
>      }
>    
> -  err = svn_io_run_cmd (loggy->path->data, name, args,
> +  err = svn_io_run_cmd (loggy->path->data, name, args, &status, 
>                          infile, outfile, errfile, loggy->pool);
>    if (err)
>       return svn_error_createf (SVN_ERR_WC_BAD_ADM_LOG, 0, NULL, loggy->pool,
>                                 "error running %s in %s",
>                                 name, loggy->path->data);
> +
> +  /* TODO: Handle status here, or pass it back to caller. */
>  
>    return SVN_NO_ERROR;
>  }
> 
> Modified: trunk/subversion/libsvn_subr/io.c
> ==============================================================================
> --- OLD/trunk/subversion/libsvn_subr/io.c	Fri Sep 21 14:25:12 2001
> +++ NEW/trunk/subversion/libsvn_subr/io.c	Fri Sep 21 14:25:12 2001
> @@ -787,6 +787,7 @@
>  svn_io_run_cmd (const char *path,
>                  const char *cmd,
>                  const char *const *args,
> +                apr_wait_t *status,
>                  apr_file_t *infile,
>                  apr_file_t *outfile,
>                  apr_file_t *errfile,
> @@ -870,7 +871,7 @@
>         cmd);
>  
>    /* Wait for the cmd command to finish. */
> -  apr_err = apr_proc_wait (&cmd_proc, NULL, APR_WAIT);
> +  apr_err = apr_proc_wait (&cmd_proc, status, APR_WAIT);
>    if (APR_STATUS_IS_CHILD_NOTDONE (apr_err))
>      return svn_error_createf
>        (apr_err, 0, NULL, pool,
> 
> Modified: trunk/subversion/svnlook/main.c
> ==============================================================================
> --- OLD/trunk/subversion/svnlook/main.c	Fri Sep 21 14:25:12 2001
> +++ NEW/trunk/subversion/svnlook/main.c	Fri Sep 21 14:25:13 2001
> @@ -468,6 +468,7 @@
>      {
>        const char *args[5];
>        apr_file_t *outhandle;
> +      apr_wait_t status;
>        apr_status_t apr_err;
>  
>        printf ("%s: %s\n", 
> @@ -493,8 +494,11 @@
>            (apr_err, 0, NULL, pool,
>             "print_diff_tree: can't open handle to stdout");
>  
> -      SVN_ERR (svn_io_run_cmd (".", SVN_CLIENT_DIFF, args, 
> -                               NULL, outhandle, NULL, pool));
> +      SVN_ERR(svn_io_run_cmd (".", SVN_CLIENT_DIFF, args, &status,
> +                              NULL, outhandle, NULL, pool));
> +
> +      /* TODO: Handle status == 2 (i.e. diff error) here. */
> +
>        printf ("\n");
>        fflush (stdout);
>      }
> @@ -920,7 +924,7 @@
>    do {                                             \
>      svn_error_t *svn_err__temp = (expr);           \
>      if (svn_err__temp) {                           \
> -      svn_handle_error (svn_err__temp, stdout, 0); \
> +      svn_handle_error (svn_err__temp, stderr, 0); \
>        goto cleanup; }                              \
>    } while (0)
>  
> 
> Modified: trunk/subversion/mod_dav_svn/version.c
> ==============================================================================
> --- OLD/trunk/subversion/mod_dav_svn/version.c	Fri Sep 21 14:25:13 2001
> +++ NEW/trunk/subversion/mod_dav_svn/version.c	Fri Sep 21 14:25:13 2001
> @@ -449,6 +449,7 @@
>    if (serr != NULL)
>      {
>        const char *msg;
> +      svn_fs_abort_txn(txn);
>  
>        if (serr->apr_err == SVN_ERR_FS_CONFLICT)
>          {
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: svn-help@subversion.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org