[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: John Gardiner Myers <jgmyers_at_proofpoint.com>
Date: Wed, 24 Dec 2008 16:03:18 -0800

Here is a corrected patch. The previous patch didn't correctly handle
an exit code of 0.

[[[
* 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
Received on 2008-12-25 09:07:06 CET

This is an archived mail posted to the Subversion Dev mailing list.