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

Re: [PATCH] Allow the merge tool to abort the merge

From: Stefan Sperling <stsp_at_elego.de>
Date: Thu, 25 Dec 2008 14:03:04 +0100

On Wed, Dec 24, 2008 at 04:03:18PM -0800, John Gardiner Myers wrote:
> Here is a corrected patch. The previous patch didn't correctly handle
> an exit code of 0.

Hi John,

I like your idea.

Two questions:

1) Why not just abort on exit code != 0?

2) Could you extend your patch to document the new behaviour somewhere?
   I don't know the appropriate place to put this information. But I
   suppose you know where merge tool authors would be looking for this
   kind of information?

Stefan

>
> [[[
> * subversion/svn/util.c: Allow external merge script to abort the merge
> by returning an
> exit code of 2.
> ]]]
> Index: subversion/svn/util.c
> ===================================================================
> --- subversion/svn/util.c (revision 34905)
> +++ subversion/svn/util.c (working copy)
> @@ -241,12 +241,23 @@
> const char *arguments[] = { merge_tool, base_path, their_path,
> my_path, merged_path, NULL};
> char *cwd;
> + int exitcode;
> apr_status_t status = apr_filepath_get(&cwd, APR_FILEPATH_NATIVE,
> pool);
> if (status != 0)
> return svn_error_wrap_apr(status, NULL);
> - return svn_io_run_cmd(svn_path_internal_style(cwd, pool), merge_tool,
> - arguments, NULL, NULL, TRUE, NULL, NULL, NULL,
> + svn_error_t *err = svn_io_run_cmd(svn_path_internal_style(cwd,
> pool), merge_tool,
> + arguments, &exitcode, NULL, TRUE, NULL, NULL,
> NULL,
> pool);
> + if (err)
> + return err;
> + if (exitcode == 0)
> + return SVN_NO_ERROR;
> + if (exitcode == 2)
> + return svn_error_create(SVN_ERR_CL_EXTERNAL_MERGE_TOOL_ABORTED, NULL,
> + _("The external merge tool aborted the
> merge"));
> + return svn_error_createf
> + (SVN_ERR_EXTERNAL_PROGRAM, NULL,
> + _("The external merge tool returned error exitcode %d"), exitcode);
> }
> }
>
> Index: subversion/include/svn_error_codes.h
> ===================================================================
> --- subversion/include/svn_error_codes.h (revision 34905)
> +++ subversion/include/svn_error_codes.h (working copy)
> @@ -1275,6 +1275,11 @@
> SVN_ERR_CL_CATEGORY_START + 10,
> "No external merge tool available")
>
> + /** @since New in 1.6. */
> + SVN_ERRDEF(SVN_ERR_CL_EXTERNAL_MERGE_TOOL_ABORTED,
> + SVN_ERR_CL_CATEGORY_START + 11,
> + "The external merge tool aborted the merge")
> +
> /* malfunctions such as assertion failures */
>
> SVN_ERRDEF(SVN_ERR_ASSERTION_FAIL,
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=991984

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=992298
Received on 2008-12-25 14:03:41 CET

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.