You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2013/11/27 08:53:35 UTC
svn commit: r1545955 [10/15] - in /subversion/branches/fsfs-improvements: ./
build/ build/ac-macros/ build/generator/ build/generator/templates/
build/win32/ contrib/server-side/ contrib/server-side/svncutter/ notes/
subversion/bindings/javahl/native/ ...
Modified: subversion/branches/fsfs-improvements/subversion/svn/list-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/svn/list-cmd.c?rev=1545955&r1=1545954&r2=1545955&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/svn/list-cmd.c (original)
+++ subversion/branches/fsfs-improvements/subversion/svn/list-cmd.c Wed Nov 27 07:53:29 2013
@@ -213,7 +213,7 @@ print_dirent_xml(void *baton,
svn_xml_make_open_tag(&sb, scratch_pool, svn_xml_normal, "external",
"parent_url", external_parent_url,
"target", external_target,
- NULL);
+ SVN_VA_NULL);
pb->last_external_parent_url = external_parent_url;
pb->last_external_target = external_target;
@@ -223,7 +223,7 @@ print_dirent_xml(void *baton,
svn_xml_make_open_tag(&sb, scratch_pool, svn_xml_normal, "entry",
"kind", svn_cl__node_kind_str_xml(dirent->kind),
- NULL);
+ SVN_VA_NULL);
svn_cl__xml_tagged_cdata(&sb, scratch_pool, "name", entryname);
@@ -237,7 +237,7 @@ print_dirent_xml(void *baton,
svn_xml_make_open_tag(&sb, scratch_pool, svn_xml_normal, "commit",
"revision",
apr_psprintf(scratch_pool, "%ld", dirent->created_rev),
- NULL);
+ SVN_VA_NULL);
svn_cl__xml_tagged_cdata(&sb, scratch_pool, "author", dirent->last_author);
if (dirent->time)
svn_cl__xml_tagged_cdata(&sb, scratch_pool, "date",
@@ -246,7 +246,8 @@ print_dirent_xml(void *baton,
if (lock)
{
- svn_xml_make_open_tag(&sb, scratch_pool, svn_xml_normal, "lock", NULL);
+ svn_xml_make_open_tag(&sb, scratch_pool, svn_xml_normal, "lock",
+ SVN_VA_NULL);
svn_cl__xml_tagged_cdata(&sb, scratch_pool, "token", lock->token);
svn_cl__xml_tagged_cdata(&sb, scratch_pool, "owner", lock->owner);
svn_cl__xml_tagged_cdata(&sb, scratch_pool, "comment", lock->comment);
@@ -359,7 +360,7 @@ svn_cl__list(apr_getopt_t *os,
svn_stringbuf_t *sb = svn_stringbuf_create_empty(pool);
svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "list",
"path", truepath[0] == '\0' ? "." : truepath,
- NULL);
+ SVN_VA_NULL);
SVN_ERR(svn_cl__error_checked_fputs(sb->data, stdout));
}
Modified: subversion/branches/fsfs-improvements/subversion/svn/log-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/svn/log-cmd.c?rev=1545955&r1=1545954&r2=1545955&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/svn/log-cmd.c (original)
+++ subversion/branches/fsfs-improvements/subversion/svn/log-cmd.c Wed Nov 27 07:53:29 2013
@@ -566,7 +566,7 @@ log_entry_receiver_xml(void *baton,
revstr = apr_psprintf(pool, "%ld", log_entry->revision);
/* <logentry revision="xxx"> */
svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "logentry",
- "revision", revstr, NULL);
+ "revision", revstr, SVN_VA_NULL);
/* <author>xxx</author> */
svn_cl__xml_tagged_cdata(&sb, pool, "author", author);
@@ -587,7 +587,7 @@ log_entry_receiver_xml(void *baton,
/* <paths> */
svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "paths",
- NULL);
+ SVN_VA_NULL);
/* Get an array of sorted hash keys. */
sorted_paths = svn_sort__hash(log_entry->changed_paths2,
@@ -619,7 +619,7 @@ log_entry_receiver_xml(void *baton,
log_item->text_modified),
"prop-mods", svn_tristate__to_word(
log_item->props_modified),
- NULL);
+ SVN_VA_NULL);
}
else
{
@@ -632,7 +632,7 @@ log_entry_receiver_xml(void *baton,
log_item->text_modified),
"prop-mods", svn_tristate__to_word(
log_item->props_modified),
- NULL);
+ SVN_VA_NULL);
}
/* xxx</path> */
svn_xml_escape_cdata_cstring(&sb, path, pool);
@@ -652,7 +652,7 @@ log_entry_receiver_xml(void *baton,
svn_compat_log_revprops_clear(log_entry->revprops);
if (log_entry->revprops && apr_hash_count(log_entry->revprops) > 0)
{
- svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "revprops", NULL);
+ svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "revprops", SVN_VA_NULL);
SVN_ERR(svn_cmdline__print_xml_prop_hash(&sb, log_entry->revprops,
FALSE, /* name_only */
FALSE, pool));
Modified: subversion/branches/fsfs-improvements/subversion/svn/propget-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/svn/propget-cmd.c?rev=1545955&r1=1545954&r2=1545955&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/svn/propget-cmd.c (original)
+++ subversion/branches/fsfs-improvements/subversion/svn/propget-cmd.c Wed Nov 27 07:53:29 2013
@@ -99,7 +99,7 @@ print_properties_xml(const char *pname,
name_local = svn_dirent_local_style(iprop->path_or_url, iterpool);
svn_xml_make_open_tag(&sb, iterpool, svn_xml_normal, "target",
- "path", name_local, NULL);
+ "path", name_local, SVN_VA_NULL);
svn_cmdline__print_xml_prop(&sb, pname, propval, TRUE, iterpool);
svn_xml_make_close_tag(&sb, iterpool, "target");
@@ -122,7 +122,7 @@ print_properties_xml(const char *pname,
svn_pool_clear(iterpool);
svn_xml_make_open_tag(&sb, iterpool, svn_xml_normal, "target",
- "path", filename, NULL);
+ "path", filename, SVN_VA_NULL);
svn_cmdline__print_xml_prop(&sb, pname, propval, FALSE, iterpool);
svn_xml_make_close_tag(&sb, iterpool, "target");
@@ -375,7 +375,7 @@ svn_cl__propget(apr_getopt_t *os,
svn_xml_make_open_tag(&sb, pool, svn_xml_normal,
"revprops",
- "rev", revstr, NULL);
+ "rev", revstr, SVN_VA_NULL);
svn_cmdline__print_xml_prop(&sb, pname_utf8, propval, FALSE,
pool);
Modified: subversion/branches/fsfs-improvements/subversion/svn/proplist-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/svn/proplist-cmd.c?rev=1545955&r1=1545954&r2=1545955&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/svn/proplist-cmd.c (original)
+++ subversion/branches/fsfs-improvements/subversion/svn/proplist-cmd.c Wed Nov 27 07:53:29 2013
@@ -83,7 +83,7 @@ proplist_receiver_xml(void *baton,
name_local = svn_dirent_local_style(iprop->path_or_url, iterpool);
svn_xml_make_open_tag(&sb, iterpool, svn_xml_normal, "target",
- "path", name_local, NULL);
+ "path", name_local, SVN_VA_NULL);
SVN_ERR(svn_cmdline__print_xml_prop_hash(&sb, iprop->prop_hash,
(! opt_state->verbose),
TRUE, iterpool));
@@ -105,7 +105,7 @@ proplist_receiver_xml(void *baton,
{
/* "<target ...>" */
svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "target",
- "path", name_local, NULL);
+ "path", name_local, SVN_VA_NULL);
SVN_ERR(svn_cmdline__print_xml_prop_hash(&sb, prop_hash,
(! opt_state->verbose),
@@ -230,7 +230,7 @@ svn_cl__proplist(apr_getopt_t *os,
svn_xml_make_open_tag(&sb, scratch_pool, svn_xml_normal,
"revprops",
- "rev", revstr, NULL);
+ "rev", revstr, SVN_VA_NULL);
SVN_ERR(svn_cmdline__print_xml_prop_hash(&sb, proplist,
(! opt_state->verbose),
FALSE, scratch_pool));
@@ -299,7 +299,7 @@ svn_cl__proplist(apr_getopt_t *os,
errors, opt_state->quiet,
SVN_ERR_UNVERSIONED_RESOURCE,
SVN_ERR_ENTRY_NOT_FOUND,
- SVN_NO_ERROR));
+ 0));
}
svn_pool_destroy(iterpool);
Modified: subversion/branches/fsfs-improvements/subversion/svn/status-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/svn/status-cmd.c?rev=1545955&r1=1545954&r2=1545955&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/svn/status-cmd.c (original)
+++ subversion/branches/fsfs-improvements/subversion/svn/status-cmd.c Wed Nov 27 07:53:29 2013
@@ -115,7 +115,7 @@ print_start_target_xml(const char *targe
svn_stringbuf_t *sb = svn_stringbuf_create_empty(pool);
svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "target",
- "path", target, NULL);
+ "path", target, SVN_VA_NULL);
return svn_cl__error_checked_fputs(sb->data, stdout);
}
@@ -135,7 +135,7 @@ print_finish_target_xml(svn_revnum_t rep
const char *repos_rev_str;
repos_rev_str = apr_psprintf(pool, "%ld", repos_rev);
svn_xml_make_open_tag(&sb, pool, svn_xml_self_closing, "against",
- "revision", repos_rev_str, NULL);
+ "revision", repos_rev_str, SVN_VA_NULL);
}
svn_xml_make_close_tag(&sb, pool, "target");
@@ -358,7 +358,8 @@ svn_cl__status(apr_getopt_t *os,
NULL, opt_state->quiet,
/* not versioned: */
SVN_ERR_WC_NOT_WORKING_COPY,
- SVN_ERR_WC_PATH_NOT_FOUND));
+ SVN_ERR_WC_PATH_NOT_FOUND,
+ 0));
if (opt_state->xml)
SVN_ERR(print_finish_target_xml(repos_rev, iterpool));
@@ -389,7 +390,7 @@ svn_cl__status(apr_getopt_t *os,
svn_stringbuf_setempty(buf);
svn_xml_make_open_tag(&buf, scratch_pool, svn_xml_normal,
"changelist", "name", changelist_name,
- NULL);
+ SVN_VA_NULL);
SVN_ERR(svn_cl__error_checked_fputs(buf->data, stdout));
}
else
Modified: subversion/branches/fsfs-improvements/subversion/svn/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/svn/status.c?rev=1545955&r1=1545954&r2=1545955&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/svn/status.c (original)
+++ subversion/branches/fsfs-improvements/subversion/svn/status.c Wed Nov 27 07:53:29 2013
@@ -492,7 +492,8 @@ svn_cl__print_status_xml(const char *tar
path = make_relpath(target_abspath, target_path, path, pool, pool);
svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "entry",
- "path", svn_dirent_local_style(path, pool), NULL);
+ "path", svn_dirent_local_style(path, pool),
+ SVN_VA_NULL);
att_hash = apr_hash_make(pool);
svn_hash_sets(att_hash, "item",
@@ -562,7 +563,7 @@ svn_cl__print_status_xml(const char *tar
generate_status_desc(combined_repos_status(status)),
"props",
generate_status_desc(status->repos_prop_status),
- NULL);
+ SVN_VA_NULL);
if (status->repos_lock)
svn_cl__print_xml_lock(&sb, status->repos_lock, pool);
Modified: subversion/branches/fsfs-improvements/subversion/svn/svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/svn/svn.c?rev=1545955&r1=1545954&r2=1545955&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/svn/svn.c (original)
+++ subversion/branches/fsfs-improvements/subversion/svn/svn.c Wed Nov 27 07:53:29 2013
@@ -1741,23 +1741,13 @@ add_search_pattern_to_latest_group(svn_c
/*** Main. ***/
-/* Report and clear the error ERR, and return EXIT_FAILURE. Suppress the
- * error message if it is SVN_ERR_IO_PIPE_WRITE_ERROR. */
-#define EXIT_ERROR(err) \
- svn_cmdline_handle_exit_error(err, NULL, "svn: ")
-
-/* A redefinition of the public SVN_INT_ERR macro, that suppresses the
- * error message if it is SVN_ERR_IO_PIPE_WRITE_ERROR. */
-#undef SVN_INT_ERR
-#define SVN_INT_ERR(expr) \
- do { \
- svn_error_t *svn_err__temp = (expr); \
- if (svn_err__temp) \
- return EXIT_ERROR(svn_err__temp); \
- } while (0)
-
-static int
-sub_main(int argc, const char *argv[], apr_pool_t *pool)
+/*
+ * On success, leave *EXIT_CODE untouched and return SVN_NO_ERROR. On error,
+ * either return an error to be displayed, or set *EXIT_CODE to non-zero and
+ * return SVN_NO_ERROR.
+ */
+static svn_error_t *
+sub_main(int *exit_code, int argc, const char *argv[], apr_pool_t *pool)
{
svn_error_t *err;
int opt_id;
@@ -1784,18 +1774,18 @@ sub_main(int argc, const char *argv[], a
received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int));
/* Check library versions */
- SVN_INT_ERR(check_lib_versions());
+ SVN_ERR(check_lib_versions());
#if defined(WIN32) || defined(__CYGWIN__)
/* Set the working copy administrative directory name. */
if (getenv("SVN_ASP_DOT_NET_HACK"))
{
- SVN_INT_ERR(svn_wc_set_adm_dir("_svn", pool));
+ SVN_ERR(svn_wc_set_adm_dir("_svn", pool));
}
#endif
/* Initialize the RA library. */
- SVN_INT_ERR(svn_ra_initialize(pool));
+ SVN_ERR(svn_ra_initialize(pool));
/* Init our changelists hash. */
changelists = apr_hash_make(pool);
@@ -1813,12 +1803,13 @@ sub_main(int argc, const char *argv[], a
/* No args? Show usage. */
if (argc <= 1)
{
- SVN_INT_ERR(svn_cl__help(NULL, NULL, pool));
- return EXIT_FAILURE;
+ SVN_ERR(svn_cl__help(NULL, NULL, pool));
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
/* Else, parse options. */
- SVN_INT_ERR(svn_cmdline__getopt_init(&os, argc, argv, pool));
+ SVN_ERR(svn_cmdline__getopt_init(&os, argc, argv, pool));
os->interleave = 1;
while (1)
@@ -1833,8 +1824,9 @@ sub_main(int argc, const char *argv[], a
break;
else if (apr_err)
{
- SVN_INT_ERR(svn_cl__help(NULL, NULL, pool));
- return EXIT_FAILURE;
+ SVN_ERR(svn_cl__help(NULL, NULL, pool));
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
/* Stash the option code in an array before parsing it. */
@@ -1843,19 +1835,17 @@ sub_main(int argc, const char *argv[], a
switch (opt_id) {
case 'l':
{
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
err = svn_cstring_atoi(&opt_state.limit, utf8_opt_arg);
if (err)
{
- err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, err,
- _("Non-numeric limit argument given"));
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, err,
+ _("Non-numeric limit argument given"));
}
if (opt_state.limit <= 0)
{
- err = svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL,
- _("Argument to --limit must be positive"));
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL,
+ _("Argument to --limit must be positive"));
}
}
break;
@@ -1868,16 +1858,14 @@ sub_main(int argc, const char *argv[], a
{
apr_array_header_t *change_revs;
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
change_revs = svn_cstring_split(utf8_opt_arg, ", \n\r\t\v", TRUE,
pool);
if (opt_state.old_target)
{
- err = svn_error_create
- (SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("Can't specify -c with --old"));
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("Can't specify -c with --old"));
}
for (i = 0; i < change_revs->nelts; i++)
@@ -1905,12 +1893,11 @@ sub_main(int argc, const char *argv[], a
{
if (changeno < 0 || is_negative)
{
- err = svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
- NULL,
- _("Negative number in range (%s)"
- " not supported with -c"),
- change_str);
- return EXIT_ERROR(err);
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
+ NULL,
+ _("Negative number in range (%s)"
+ " not supported with -c"),
+ change_str);
}
s = end + 1;
while (*s == 'r')
@@ -1919,17 +1906,15 @@ sub_main(int argc, const char *argv[], a
}
if (end == change_str || *end != '\0')
{
- err = svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("Non-numeric change argument (%s) "
- "given to -c"), change_str);
- return EXIT_ERROR(err);
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("Non-numeric change argument (%s) "
+ "given to -c"), change_str);
}
if (changeno == 0)
{
- err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("There is no change 0"));
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("There is no change 0"));
}
if (is_negative)
@@ -1965,15 +1950,13 @@ sub_main(int argc, const char *argv[], a
break;
case 'r':
opt_state.used_revision_arg = TRUE;
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
if (svn_opt_parse_revision_to_range(opt_state.revision_ranges,
utf8_opt_arg, pool) != 0)
{
- err = svn_error_createf
- (SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
_("Syntax error in revision argument '%s'"),
utf8_opt_arg);
- return EXIT_ERROR(err);
}
break;
case 'v':
@@ -1996,9 +1979,9 @@ sub_main(int argc, const char *argv[], a
/* We read the raw file content here. We will convert it to UTF-8
* later (if it's a log/lock message or an svn:* prop value),
* according to the value of the '--encoding' option. */
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
- SVN_INT_ERR(svn_stringbuf_from_file2(&(opt_state.filedata),
- utf8_opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(svn_stringbuf_from_file2(&(opt_state.filedata),
+ utf8_opt_arg, pool));
reading_file_from_stdin = (strcmp(utf8_opt_arg, "-") == 0);
dash_F_arg = utf8_opt_arg;
break;
@@ -2006,9 +1989,9 @@ sub_main(int argc, const char *argv[], a
{
svn_stringbuf_t *buffer, *buffer_utf8;
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
- SVN_INT_ERR(svn_stringbuf_from_file2(&buffer, utf8_opt_arg, pool));
- SVN_INT_ERR(svn_utf_stringbuf_to_utf8(&buffer_utf8, buffer, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(svn_stringbuf_from_file2(&buffer, utf8_opt_arg, pool));
+ SVN_ERR(svn_utf_stringbuf_to_utf8(&buffer_utf8, buffer, pool));
opt_state.targets = svn_cstring_split(buffer_utf8->data, "\n\r",
TRUE, pool);
}
@@ -2034,51 +2017,47 @@ sub_main(int argc, const char *argv[], a
case opt_depth:
err = svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool);
if (err)
- return EXIT_ERROR
- (svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, err,
- _("Error converting depth "
- "from locale to UTF-8")));
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, err,
+ _("Error converting depth "
+ "from locale to UTF-8"));
opt_state.depth = svn_depth_from_word(utf8_opt_arg);
if (opt_state.depth == svn_depth_unknown
|| opt_state.depth == svn_depth_exclude)
{
- return EXIT_ERROR
- (svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("'%s' is not a valid depth; try "
- "'empty', 'files', 'immediates', "
- "or 'infinity'"),
- utf8_opt_arg));
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a valid depth; try "
+ "'empty', 'files', 'immediates', "
+ "or 'infinity'"),
+ utf8_opt_arg);
}
break;
case opt_set_depth:
err = svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool);
if (err)
- return EXIT_ERROR
- (svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, err,
- _("Error converting depth "
- "from locale to UTF-8")));
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, err,
+ _("Error converting depth "
+ "from locale to UTF-8"));
opt_state.set_depth = svn_depth_from_word(utf8_opt_arg);
/* svn_depth_exclude is okay for --set-depth. */
if (opt_state.set_depth == svn_depth_unknown)
{
- return EXIT_ERROR
- (svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("'%s' is not a valid depth; try "
- "'exclude', 'empty', 'files', "
- "'immediates', or 'infinity'"),
- utf8_opt_arg));
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a valid depth; try "
+ "'exclude', 'empty', 'files', "
+ "'immediates', or 'infinity'"),
+ utf8_opt_arg);
}
break;
case opt_version:
opt_state.version = TRUE;
break;
case opt_auth_username:
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.auth_username,
- opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.auth_username,
+ opt_arg, pool));
break;
case opt_auth_password:
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.auth_password,
- opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.auth_password,
+ opt_arg, pool));
break;
case opt_encoding:
opt_state.encoding = apr_pstrdup(pool, opt_arg);
@@ -2132,8 +2111,8 @@ sub_main(int argc, const char *argv[], a
opt_state.relocate = TRUE;
break;
case 'x':
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.extensions,
- opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.extensions,
+ opt_arg, pool));
break;
case opt_diff_cmd:
opt_state.diff.diff_cmd = apr_pstrdup(pool, opt_arg);
@@ -2150,20 +2129,18 @@ sub_main(int argc, const char *argv[], a
case opt_old_cmd:
if (opt_state.used_change_arg)
{
- err = svn_error_create
- (SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("Can't specify -c with --old"));
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("Can't specify -c with --old"));
}
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
opt_state.old_target = apr_pstrdup(pool, utf8_opt_arg);
break;
case opt_new_cmd:
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
opt_state.new_target = apr_pstrdup(pool, utf8_opt_arg);
break;
case opt_config_dir:
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
opt_state.config_dir = svn_dirent_internal_style(utf8_opt_arg, pool);
break;
case opt_config_options:
@@ -2172,9 +2149,9 @@ sub_main(int argc, const char *argv[], a
apr_array_make(pool, 1,
sizeof(svn_cmdline__config_argument_t*));
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
- SVN_INT_ERR(svn_cmdline__parse_config_option(opt_state.config_options,
- utf8_opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(svn_cmdline__parse_config_option(opt_state.config_options,
+ utf8_opt_arg, pool));
break;
case opt_autoprops:
opt_state.autoprops = TRUE;
@@ -2183,17 +2160,15 @@ sub_main(int argc, const char *argv[], a
opt_state.no_autoprops = TRUE;
break;
case opt_native_eol:
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
if ( !strcmp("LF", utf8_opt_arg) || !strcmp("CR", utf8_opt_arg) ||
!strcmp("CRLF", utf8_opt_arg))
opt_state.native_eol = utf8_opt_arg;
else
{
- err = svn_error_createf
- (SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
_("Syntax error in native-eol argument '%s'"),
utf8_opt_arg);
- return EXIT_ERROR(err);
}
break;
case opt_no_unlock:
@@ -2206,12 +2181,11 @@ sub_main(int argc, const char *argv[], a
opt_state.remove = TRUE;
break;
case opt_changelist:
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
if (utf8_opt_arg[0] == '\0')
{
- err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("Changelist names must not be empty"));
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("Changelist names must not be empty"));
}
svn_hash_sets(changelists, utf8_opt_arg, (void *)1);
break;
@@ -2230,8 +2204,8 @@ sub_main(int argc, const char *argv[], a
opt_state.no_revprops = TRUE;
break;
case opt_with_revprop:
- SVN_INT_ERR(svn_opt_parse_revprop(&opt_state.revprop_table,
- opt_arg, pool));
+ SVN_ERR(svn_opt_parse_revprop(&opt_state.revprop_table,
+ opt_arg, pool));
break;
case opt_parents:
opt_state.parents = TRUE;
@@ -2243,22 +2217,20 @@ sub_main(int argc, const char *argv[], a
opt_state.auto_moves = TRUE;
break;
case opt_accept:
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
opt_state.accept_which = svn_cl__accept_from_word(utf8_opt_arg);
if (opt_state.accept_which == svn_cl__accept_invalid)
- return EXIT_ERROR
- (svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("'%s' is not a valid --accept value"),
- utf8_opt_arg));
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a valid --accept value"),
+ utf8_opt_arg);
break;
case opt_show_revs:
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
opt_state.show_revs = svn_cl__show_revs_from_word(utf8_opt_arg);
if (opt_state.show_revs == svn_cl__show_revs_invalid)
- return EXIT_ERROR
- (svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("'%s' is not a valid --show-revs value"),
- utf8_opt_arg));
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a valid --show-revs value"),
+ utf8_opt_arg);
break;
case opt_mergeinfo_log:
opt_state.mergeinfo_log = TRUE;
@@ -2268,20 +2240,18 @@ sub_main(int argc, const char *argv[], a
break;
case opt_strip:
{
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
err = svn_cstring_atoi(&opt_state.strip, utf8_opt_arg);
if (err)
{
- err = svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, err,
- _("Invalid strip count '%s'"),
- utf8_opt_arg);
- return EXIT_ERROR(err);
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, err,
+ _("Invalid strip count '%s'"),
+ utf8_opt_arg);
}
if (opt_state.strip < 0)
{
- err = svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL,
- _("Argument to --strip must be positive"));
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL,
+ _("Argument to --strip must be positive"));
}
}
break;
@@ -2319,11 +2289,11 @@ sub_main(int argc, const char *argv[], a
opt_state.diff.properties_only = TRUE;
break;
case opt_search:
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
add_search_pattern_group(&opt_state, utf8_opt_arg, pool);
break;
case opt_search_and:
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
add_search_pattern_to_latest_group(&opt_state, utf8_opt_arg, pool);
case opt_remove_unversioned:
opt_state.remove_unversioned = TRUE;
@@ -2345,10 +2315,9 @@ sub_main(int argc, const char *argv[], a
* exclusive. */
if (opt_state.non_interactive && force_interactive)
{
- err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("--non-interactive and --force-interactive "
- "are mutually exclusive"));
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--non-interactive and --force-interactive "
+ "are mutually exclusive"));
}
else
opt_state.non_interactive = !svn_cmdline__be_interactive(
@@ -2356,7 +2325,7 @@ sub_main(int argc, const char *argv[], a
force_interactive);
/* Turn our hash of changelists into an array of unique ones. */
- SVN_INT_ERR(svn_hash_keys(&(opt_state.changelists), changelists, pool));
+ SVN_ERR(svn_hash_keys(&(opt_state.changelists), changelists, pool));
/* ### This really belongs in libsvn_client. The trouble is,
there's no one place there to run it from, no
@@ -2368,7 +2337,7 @@ sub_main(int argc, const char *argv[], a
hand, the alternative is effectively to demand that they call
svn_config_ensure() instead, so maybe we should have a generic
init function anyway. Thoughts? */
- SVN_INT_ERR(svn_config_ensure(opt_state.config_dir, pool));
+ SVN_ERR(svn_config_ensure(opt_state.config_dir, pool));
/* If the user asked for help, then the rest of the arguments are
the names of subcommands to get help on (if any), or else they're
@@ -2402,7 +2371,8 @@ sub_main(int argc, const char *argv[], a
(svn_cmdline_fprintf(stderr, pool,
_("Subcommand argument required\n")));
svn_error_clear(svn_cl__help(NULL, NULL, pool));
- return EXIT_FAILURE;
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
}
else
@@ -2413,8 +2383,8 @@ sub_main(int argc, const char *argv[], a
if (subcommand == NULL)
{
const char *first_arg_utf8;
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8,
- first_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8,
+ first_arg, pool));
svn_error_clear
(svn_cmdline_fprintf(stderr, pool,
_("Unknown subcommand: '%s'\n"),
@@ -2431,7 +2401,8 @@ sub_main(int argc, const char *argv[], a
"command.\n")));
}
- return EXIT_FAILURE;
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
}
}
@@ -2464,7 +2435,8 @@ sub_main(int argc, const char *argv[], a
(stderr, pool, _("Subcommand '%s' doesn't accept option '%s'\n"
"Type 'svn help %s' for usage.\n"),
subcommand->name, optstr, subcommand->name));
- return EXIT_FAILURE;
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
}
@@ -2474,11 +2446,10 @@ sub_main(int argc, const char *argv[], a
{
if (opt_state.revision_ranges->nelts > 1)
{
- err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("Multiple revision arguments "
- "encountered; can't specify -c twice, "
- "or both -c and -r"));
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("Multiple revision arguments "
+ "encountered; can't specify -c twice, "
+ "or both -c and -r"));
}
}
@@ -2486,30 +2457,27 @@ sub_main(int argc, const char *argv[], a
if ((opt_state.depth != svn_depth_unknown)
&& (opt_state.set_depth != svn_depth_unknown))
{
- err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("--depth and --set-depth are mutually "
- "exclusive"));
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--depth and --set-depth are mutually "
+ "exclusive"));
}
/* Disallow simultaneous use of both --with-all-revprops and
--with-no-revprops. */
if (opt_state.all_revprops && opt_state.no_revprops)
{
- err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("--with-all-revprops and --with-no-revprops "
- "are mutually exclusive"));
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--with-all-revprops and --with-no-revprops "
+ "are mutually exclusive"));
}
/* Disallow simultaneous use of both --with-revprop and
--with-no-revprops. */
if (opt_state.revprop_table && opt_state.no_revprops)
{
- err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("--with-revprop and --with-no-revprops "
- "are mutually exclusive"));
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--with-revprop and --with-no-revprops "
+ "are mutually exclusive"));
}
#ifdef SVN_CL__OPTION_WITH_REVPROP_CAN_SET_PROPERTIES_IN_SVN_NAMESPACE
@@ -2523,9 +2491,9 @@ sub_main(int argc, const char *argv[], a
for (hi = apr_hash_first(pool, opt_state.revprop_table);
hi; hi = apr_hash_next(hi))
{
- SVN_INT_ERR(svn_cl__check_svn_prop_name(svn__apr_hash_index_key(hi),
- TRUE, svn_cl__prop_use_use,
- pool));
+ SVN_ERR(svn_cl__check_svn_prop_name(svn__apr_hash_index_key(hi),
+ TRUE, svn_cl__prop_use_use,
+ pool));
}
}
#endif /* SVN_CL__OPTION_WITH_REVPROP_CAN_SET_PROPERTIES_IN_SVN_NAMESPACE */
@@ -2537,29 +2505,26 @@ sub_main(int argc, const char *argv[], a
if (opt_state.filedata && opt_state.message
&& subcommand->cmd_func != svn_cl__propset)
{
- err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("--message (-m) and --file (-F) "
- "are mutually exclusive"));
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--message (-m) and --file (-F) "
+ "are mutually exclusive"));
}
/* --trust-server-cert can only be used with --non-interactive */
if (opt_state.trust_server_cert && !opt_state.non_interactive)
{
- err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("--trust-server-cert requires "
- "--non-interactive"));
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--trust-server-cert requires "
+ "--non-interactive"));
}
/* Disallow simultaneous use of both --diff-cmd and
--internal-diff. */
if (opt_state.diff.diff_cmd && opt_state.diff.internal_diff)
{
- err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("--diff-cmd and --internal-diff "
- "are mutually exclusive"));
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--diff-cmd and --internal-diff "
+ "are mutually exclusive"));
}
/* Ensure that 'revision_ranges' has at least one item, and make
@@ -2590,7 +2555,7 @@ sub_main(int argc, const char *argv[], a
cfg_hash = NULL;
}
else
- return EXIT_ERROR(err);
+ return err;
}
/* Relocation is infinite-depth only. */
@@ -2598,18 +2563,16 @@ sub_main(int argc, const char *argv[], a
{
if (opt_state.depth != svn_depth_unknown)
{
- err = svn_error_create(SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL,
- _("--relocate and --depth are mutually "
- "exclusive"));
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL,
+ _("--relocate and --depth are mutually "
+ "exclusive"));
}
if (! descend)
{
- err = svn_error_create(
+ return svn_error_create(
SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL,
_("--relocate and --non-recursive (-N) are mutually "
"exclusive"));
- return EXIT_ERROR(err);
}
}
@@ -2623,8 +2586,7 @@ sub_main(int argc, const char *argv[], a
{
if (opt_state.end_revision.kind != svn_opt_revision_unspecified)
{
- err = svn_error_create(SVN_ERR_CLIENT_REVISION_RANGE, NULL, NULL);
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_CLIENT_REVISION_RANGE, NULL, NULL);
}
}
@@ -2691,7 +2653,7 @@ sub_main(int argc, const char *argv[], a
/* Create a client context object. */
command_baton.opt_state = &opt_state;
- SVN_INT_ERR(svn_client_create_context2(&ctx, cfg_hash, pool));
+ SVN_ERR(svn_client_create_context2(&ctx, cfg_hash, pool));
command_baton.ctx = ctx;
/* If we're running a command that could result in a commit, verify
@@ -2727,19 +2689,18 @@ sub_main(int argc, const char *argv[], a
{
if (subcommand->cmd_func != svn_cl__lock)
{
- err = svn_error_create(
+ return svn_error_create(
SVN_ERR_CL_LOG_MESSAGE_IS_VERSIONED_FILE, NULL,
_("Log message file is a versioned file; "
"use '--force-log' to override"));
}
else
{
- err = svn_error_create(
+ return svn_error_create(
SVN_ERR_CL_LOG_MESSAGE_IS_VERSIONED_FILE, NULL,
_("Lock comment file is a versioned file; "
"use '--force-log' to override"));
}
- return EXIT_ERROR(err);
}
}
svn_error_clear(err);
@@ -2755,19 +2716,18 @@ sub_main(int argc, const char *argv[], a
{
if (subcommand->cmd_func != svn_cl__lock)
{
- err = svn_error_create
+ return svn_error_create
(SVN_ERR_CL_LOG_MESSAGE_IS_PATHNAME, NULL,
_("The log message is a pathname "
"(was -F intended?); use '--force-log' to override"));
}
else
{
- err = svn_error_create
+ return svn_error_create
(SVN_ERR_CL_LOG_MESSAGE_IS_PATHNAME, NULL,
_("The lock comment is a pathname "
"(was -F intended?); use '--force-log' to override"));
}
- return EXIT_ERROR(err);
}
}
}
@@ -2787,10 +2747,9 @@ sub_main(int argc, const char *argv[], a
/* Check for mutually exclusive args --auto-props and --no-auto-props */
if (opt_state.autoprops && opt_state.no_autoprops)
{
- err = svn_error_create(SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL,
- _("--auto-props and --no-auto-props are "
- "mutually exclusive"));
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL,
+ _("--auto-props and --no-auto-props are "
+ "mutually exclusive"));
}
/* Update auto-props-enable option, and populate the MIME types map,
@@ -2804,8 +2763,8 @@ sub_main(int argc, const char *argv[], a
SVN_CONFIG_OPTION_MIMETYPES_FILE, FALSE);
if (mimetypes_file && *mimetypes_file)
{
- SVN_INT_ERR(svn_io_parse_mimetypes_file(&(ctx->mimetypes_map),
- mimetypes_file, pool));
+ SVN_ERR(svn_io_parse_mimetypes_file(&(ctx->mimetypes_map),
+ mimetypes_file, pool));
}
if (opt_state.autoprops)
@@ -2843,8 +2802,8 @@ sub_main(int argc, const char *argv[], a
use_notifier = FALSE;
if (use_notifier)
{
- SVN_INT_ERR(svn_cl__get_notifier(&ctx->notify_func2, &ctx->notify_baton2,
- conflict_stats, pool));
+ SVN_ERR(svn_cl__get_notifier(&ctx->notify_func2, &ctx->notify_baton2,
+ conflict_stats, pool));
}
/* Set up our cancellation support. */
@@ -2874,35 +2833,36 @@ sub_main(int argc, const char *argv[], a
#endif
/* Set up Authentication stuff. */
- SVN_INT_ERR(svn_cmdline_create_auth_baton(&ab,
- opt_state.non_interactive,
- opt_state.auth_username,
- opt_state.auth_password,
- opt_state.config_dir,
- opt_state.no_auth_cache,
- opt_state.trust_server_cert,
- cfg_config,
- ctx->cancel_func,
- ctx->cancel_baton,
- pool));
+ SVN_ERR(svn_cmdline_create_auth_baton(&ab,
+ opt_state.non_interactive,
+ opt_state.auth_username,
+ opt_state.auth_password,
+ opt_state.config_dir,
+ opt_state.no_auth_cache,
+ opt_state.trust_server_cert,
+ cfg_config,
+ ctx->cancel_func,
+ ctx->cancel_baton,
+ pool));
ctx->auth_baton = ab;
if (opt_state.non_interactive)
{
if (opt_state.accept_which == svn_cl__accept_edit)
- return EXIT_ERROR(
- svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ {
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
_("--accept=%s incompatible with"
" --non-interactive"),
- SVN_CL__ACCEPT_EDIT));
-
+ SVN_CL__ACCEPT_EDIT);
+ }
if (opt_state.accept_which == svn_cl__accept_launch)
- return EXIT_ERROR(
- svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ {
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
_("--accept=%s incompatible with"
" --non-interactive"),
- SVN_CL__ACCEPT_LAUNCH));
+ SVN_CL__ACCEPT_LAUNCH);
+ }
/* The default action when we're non-interactive is to postpone
* conflict resolution. */
@@ -2913,10 +2873,10 @@ sub_main(int argc, const char *argv[], a
/* Check whether interactive conflict resolution is disabled by
* the configuration file. If no --accept option was specified
* we postpone all conflicts in this case. */
- SVN_INT_ERR(svn_config_get_bool(cfg_config, &interactive_conflicts,
- SVN_CONFIG_SECTION_MISCELLANY,
- SVN_CONFIG_OPTION_INTERACTIVE_CONFLICTS,
- TRUE));
+ SVN_ERR(svn_config_get_bool(cfg_config, &interactive_conflicts,
+ SVN_CONFIG_SECTION_MISCELLANY,
+ SVN_CONFIG_OPTION_INTERACTIVE_CONFLICTS,
+ TRUE));
if (!interactive_conflicts)
{
/* Make 'svn resolve' non-interactive. */
@@ -2937,7 +2897,7 @@ sub_main(int argc, const char *argv[], a
ctx->conflict_baton = NULL;
ctx->conflict_func2 = svn_cl__conflict_func_interactive;
- SVN_INT_ERR(svn_cl__get_conflict_func_interactive_baton(
+ SVN_ERR(svn_cl__get_conflict_func_interactive_baton(
&b,
opt_state.accept_which,
ctx->config, opt_state.editor_cmd, conflict_stats,
@@ -3010,27 +2970,18 @@ sub_main(int argc, const char *argv[], a
"Subversion"));
}
- /* Ensure that stdout is flushed, so the user will see any write errors.
- This makes sure that output is not silently lost. */
- SVN_INT_ERR(svn_cmdline_fflush(stdout));
-
- return EXIT_ERROR(err);
+ return err;
}
- else
- {
- /* Ensure that stdout is flushed, so the user will see any write errors.
- This makes sure that output is not silently lost. */
- SVN_INT_ERR(svn_cmdline_fflush(stdout));
- return EXIT_SUCCESS;
- }
+ return SVN_NO_ERROR;
}
int
main(int argc, const char *argv[])
{
apr_pool_t *pool;
- int exit_code;
+ int exit_code = EXIT_SUCCESS;
+ svn_error_t *err;
/* Initialize the app. */
if (svn_cmdline_init("svn", stderr) != EXIT_SUCCESS)
@@ -3041,7 +2992,17 @@ main(int argc, const char *argv[])
*/
pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE));
- exit_code = sub_main(argc, argv, pool);
+ err = sub_main(&exit_code, argc, argv, pool);
+
+ /* Flush stdout and report if it fails. It would be flushed on exit anyway
+ but this makes sure that output is not silently lost if it fails. */
+ err = svn_error_compose_create(err, svn_cmdline_fflush(stdout));
+
+ if (err)
+ {
+ exit_code = EXIT_FAILURE;
+ svn_cmdline_handle_exit_error(err, NULL, "svn: ");
+ }
svn_pool_destroy(pool);
return exit_code;
Modified: subversion/branches/fsfs-improvements/subversion/svn/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/svn/util.c?rev=1545955&r1=1545954&r2=1545955&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/svn/util.c (original)
+++ subversion/branches/fsfs-improvements/subversion/svn/util.c Wed Nov 27 07:53:29 2013
@@ -626,7 +626,7 @@ svn_cl__xml_tagged_cdata(svn_stringbuf_t
if (string)
{
svn_xml_make_open_tag(sb, pool, svn_xml_protect_pcdata,
- tagname, NULL);
+ tagname, SVN_VA_NULL);
svn_xml_escape_cdata_cstring(sb, string, pool);
svn_xml_make_close_tag(sb, pool, tagname);
}
@@ -643,7 +643,7 @@ svn_cl__print_xml_commit(svn_stringbuf_t
/* "<commit ...>" */
svn_xml_make_open_tag(sb, pool, svn_xml_normal, "commit",
"revision",
- apr_psprintf(pool, "%ld", revision), NULL);
+ apr_psprintf(pool, "%ld", revision), SVN_VA_NULL);
/* "<author>xx</author>" */
if (author)
@@ -664,7 +664,7 @@ svn_cl__print_xml_lock(svn_stringbuf_t *
apr_pool_t *pool)
{
/* "<lock>" */
- svn_xml_make_open_tag(sb, pool, svn_xml_normal, "lock", NULL);
+ svn_xml_make_open_tag(sb, pool, svn_xml_normal, "lock", SVN_VA_NULL);
/* "<token>xx</token>" */
svn_cl__xml_tagged_cdata(sb, pool, "token", lock->token);
@@ -699,7 +699,7 @@ svn_cl__xml_print_header(const char *tag
svn_xml_make_header2(&sb, "UTF-8", pool);
/* "<TAGNAME>" */
- svn_xml_make_open_tag(&sb, pool, svn_xml_normal, tagname, NULL);
+ svn_xml_make_open_tag(&sb, pool, svn_xml_normal, tagname, SVN_VA_NULL);
return svn_cl__error_checked_fputs(sb->data, stdout);
}
Modified: subversion/branches/fsfs-improvements/subversion/svnadmin/svnadmin.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/svnadmin/svnadmin.c?rev=1545955&r1=1545954&r2=1545955&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/svnadmin/svnadmin.c (original)
+++ subversion/branches/fsfs-improvements/subversion/svnadmin/svnadmin.c Wed Nov 27 07:53:29 2013
@@ -197,7 +197,8 @@ enum svnadmin__cmdline_options_t
svnadmin__pre_1_4_compatible,
svnadmin__pre_1_5_compatible,
svnadmin__pre_1_6_compatible,
- svnadmin__compatible_version
+ svnadmin__compatible_version,
+ svnadmin__check_ucs_normalization
};
/* Option codes and descriptions.
@@ -302,6 +303,14 @@ static const apr_getopt_option_t options
{"file", 'F', 1, N_("read repository paths from file ARG")},
+ {"check-ucs-normalization", svnadmin__check_ucs_normalization, 0,
+ N_("report paths in the filesystem and mergeinfo\n"
+ " that are not normalized to Unicode Normalization\n"
+ " Form C, and any names within the same directory\n"
+ " or svn:mergeinfo property value that differ only\n"
+ " in character representation, but are otherwise\n"
+ " identical")},
+
{NULL}
};
@@ -494,7 +503,8 @@ static const svn_opt_subcommand_desc2_t
{"verify", subcommand_verify, {0}, N_
("usage: svnadmin verify REPOS_PATH\n\n"
"Verify the data stored in the repository.\n"),
- {'t', 'r', 'q', svnadmin__keep_going, 'M'} },
+ {'t', 'r', 'q', svnadmin__keep_going, 'M',
+ svnadmin__check_ucs_normalization} },
{ NULL, NULL, {0}, NULL, {0} }
};
@@ -523,6 +533,7 @@ struct svnadmin_opt_state
svn_boolean_t bypass_hooks; /* --bypass-hooks */
svn_boolean_t wait; /* --wait */
svn_boolean_t keep_going; /* --keep-going */
+ svn_boolean_t check_ucs_norm; /* --check-ucs-normalization */
svn_boolean_t bypass_prop_validation; /* --bypass-prop-validation */
enum svn_repos_load_uuid uuid_action; /* --ignore-uuid,
--force-uuid */
@@ -1689,6 +1700,7 @@ subcommand_verify(apr_getopt_t *os, void
return svn_error_trace(svn_repos_verify_fs3(repos, lower, upper,
opt_state->keep_going,
+ opt_state->check_ucs_norm,
!opt_state->quiet
? repos_notify_handler : NULL,
progress_stream, check_cancel,
@@ -2135,23 +2147,13 @@ subcommand_upgrade(apr_getopt_t *os, voi
/** Main. **/
-/* Report and clear the error ERR, and return EXIT_FAILURE. */
-#define EXIT_ERROR(err) \
- svn_cmdline_handle_exit_error(err, NULL, "svnadmin: ")
-
-/* A redefinition of the public SVN_INT_ERR macro, that suppresses the
- * error message if it is SVN_ERR_IO_PIPE_WRITE_ERROR, amd with the
- * program name 'svnadmin' instead of 'svn'. */
-#undef SVN_INT_ERR
-#define SVN_INT_ERR(expr) \
- do { \
- svn_error_t *svn_err__temp = (expr); \
- if (svn_err__temp) \
- return EXIT_ERROR(svn_err__temp); \
- } while (0)
-
-static int
-sub_main(int argc, const char *argv[], apr_pool_t *pool)
+/*
+ * On success, leave *EXIT_CODE untouched and return SVN_NO_ERROR. On error,
+ * either return an error to be displayed, or set *EXIT_CODE to non-zero and
+ * return SVN_NO_ERROR.
+ */
+static svn_error_t *
+sub_main(int *exit_code, int argc, const char *argv[], apr_pool_t *pool)
{
svn_error_t *err;
apr_status_t apr_err;
@@ -2167,15 +2169,16 @@ sub_main(int argc, const char *argv[], a
received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int));
/* Check library versions */
- SVN_INT_ERR(check_lib_versions());
+ SVN_ERR(check_lib_versions());
/* Initialize the FS library. */
- SVN_INT_ERR(svn_fs_initialize(pool));
+ SVN_ERR(svn_fs_initialize(pool));
if (argc <= 1)
{
- SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
- return EXIT_FAILURE;
+ SVN_ERR(subcommand_help(NULL, NULL, pool));
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
/* Initialize opt_state. */
@@ -2184,7 +2187,7 @@ sub_main(int argc, const char *argv[], a
opt_state.memory_cache_size = svn_cache_config_get()->cache_size;
/* Parse options. */
- SVN_INT_ERR(svn_cmdline__getopt_init(&os, argc, argv, pool));
+ SVN_ERR(svn_cmdline__getopt_init(&os, argc, argv, pool));
os->interleave = 1;
@@ -2199,8 +2202,9 @@ sub_main(int argc, const char *argv[], a
break;
else if (apr_err)
{
- SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
- return EXIT_FAILURE;
+ SVN_ERR(subcommand_help(NULL, NULL, pool));
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
/* Stash the option code in an array before parsing it. */
@@ -2211,23 +2215,19 @@ sub_main(int argc, const char *argv[], a
{
if (opt_state.start_revision.kind != svn_opt_revision_unspecified)
{
- err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("Multiple revision arguments encountered; "
- "try '-r N:M' instead of '-r N -r M'"));
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("Multiple revision arguments encountered; "
+ "try '-r N:M' instead of '-r N -r M'"));
}
if (svn_opt_parse_revision(&(opt_state.start_revision),
&(opt_state.end_revision),
opt_arg, pool) != 0)
{
- err = svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg,
- pool);
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
- if (! err)
- err = svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
_("Syntax error in revision argument '%s'"),
utf8_opt_arg);
- return EXIT_ERROR(err);
}
}
break;
@@ -2247,8 +2247,8 @@ sub_main(int argc, const char *argv[], a
= 0x100000 * apr_strtoi64(opt_arg, NULL, 0);
break;
case 'F':
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
- SVN_INT_ERR(svn_stringbuf_from_file2(&(opt_state.filedata),
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(svn_stringbuf_from_file2(&(opt_state.filedata),
utf8_opt_arg, pool));
dash_F_arg = TRUE;
case svnadmin__version:
@@ -2289,16 +2289,15 @@ sub_main(int argc, const char *argv[], a
/* Parse the version string which carries our target
compatibility. */
- SVN_INT_ERR(svn_version__parse_version_string(&compatible_version,
+ SVN_ERR(svn_version__parse_version_string(&compatible_version,
opt_arg, pool));
/* We can't create repository with a version older than 1.0.0. */
if (! svn_version__at_least(compatible_version, 1, 0, 0))
{
- err = svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
- _("Cannot create pre-1.0-compatible "
- "repositories"));
- return EXIT_ERROR(err);
+ return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+ _("Cannot create pre-1.0-compatible "
+ "repositories"));
}
/* We can't create repository with a version newer than what
@@ -2308,12 +2307,11 @@ sub_main(int argc, const char *argv[], a
compatible_version->minor,
compatible_version->patch))
{
- err = svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
- _("Cannot guarantee compatibility "
- "beyond the current running version "
- "(%s)"),
- SVN_VER_NUM );
- return EXIT_ERROR(err);
+ return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+ _("Cannot guarantee compatibility "
+ "beyond the current running version "
+ "(%s)"),
+ SVN_VER_NUM);
}
opt_state.compatible_version = compatible_version;
@@ -2322,11 +2320,14 @@ sub_main(int argc, const char *argv[], a
case svnadmin__keep_going:
opt_state.keep_going = TRUE;
break;
+ case svnadmin__check_ucs_normalization:
+ opt_state.check_ucs_norm = TRUE;
+ break;
case svnadmin__fs_type:
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.fs_type, opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.fs_type, opt_arg, pool));
break;
case svnadmin__parent_dir:
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.parent_dir, opt_arg,
+ SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.parent_dir, opt_arg,
pool));
opt_state.parent_dir
= svn_dirent_internal_style(opt_state.parent_dir, pool);
@@ -2359,7 +2360,7 @@ sub_main(int argc, const char *argv[], a
opt_state.clean_logs = TRUE;
break;
case svnadmin__config_dir:
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
opt_state.config_dir =
apr_pstrdup(pool, svn_dirent_canonicalize(utf8_opt_arg, pool));
break;
@@ -2368,8 +2369,9 @@ sub_main(int argc, const char *argv[], a
break;
default:
{
- SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
- return EXIT_FAILURE;
+ SVN_ERR(subcommand_help(NULL, NULL, pool));
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
} /* close `switch' */
} /* close `while' */
@@ -2402,8 +2404,9 @@ sub_main(int argc, const char *argv[], a
{
svn_error_clear(svn_cmdline_fprintf(stderr, pool,
_("subcommand argument required\n")));
- SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
- return EXIT_FAILURE;
+ SVN_ERR(subcommand_help(NULL, NULL, pool));
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
}
else
@@ -2413,14 +2416,15 @@ sub_main(int argc, const char *argv[], a
if (subcommand == NULL)
{
const char *first_arg_utf8;
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8,
+ SVN_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8,
first_arg, pool));
svn_error_clear(
svn_cmdline_fprintf(stderr, pool,
_("Unknown subcommand: '%s'\n"),
first_arg_utf8));
- SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
- return EXIT_FAILURE;
+ SVN_ERR(subcommand_help(NULL, NULL, pool));
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
}
}
@@ -2435,23 +2439,17 @@ sub_main(int argc, const char *argv[], a
if (os->ind >= os->argc)
{
- err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("Repository argument required"));
- return EXIT_ERROR(err);
+ return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("Repository argument required"));
}
- if ((err = svn_utf_cstring_to_utf8(&repos_path,
- os->argv[os->ind++], pool)))
- {
- return EXIT_ERROR(err);
- }
+ SVN_ERR(svn_utf_cstring_to_utf8(&repos_path, os->argv[os->ind++], pool));
if (svn_path_is_url(repos_path))
{
- err = svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("'%s' is a URL when it should be a "
- "local path"), repos_path);
- return EXIT_ERROR(err);
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is a URL when it should be a "
+ "local path"), repos_path);
}
opt_state.repository_path = svn_dirent_internal_style(repos_path, pool);
@@ -2477,13 +2475,14 @@ sub_main(int argc, const char *argv[], a
pool);
svn_opt_format_option(&optstr, badopt, FALSE, pool);
if (subcommand->name[0] == '-')
- SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
+ SVN_ERR(subcommand_help(NULL, NULL, pool));
else
svn_error_clear(svn_cmdline_fprintf(stderr, pool
, _("Subcommand '%s' doesn't accept option '%s'\n"
"Type 'svnadmin help %s' for usage.\n"),
subcommand->name, optstr, subcommand->name));
- return EXIT_FAILURE;
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
}
@@ -2525,26 +2524,18 @@ sub_main(int argc, const char *argv[], a
err = svn_error_quick_wrap(err,
_("Try 'svnadmin help' for more info"));
}
- return EXIT_ERROR(err);
- }
- else
- {
- /* Ensure that everything is written to stdout, so the user will
- see any print errors. */
- err = svn_cmdline_fflush(stdout);
- if (err)
- {
- return EXIT_ERROR(err);
- }
- return EXIT_SUCCESS;
+ return err;
}
+
+ return SVN_NO_ERROR;
}
int
main(int argc, const char *argv[])
{
apr_pool_t *pool;
- int exit_code;
+ int exit_code = EXIT_SUCCESS;
+ svn_error_t *err;
/* Initialize the app. */
if (svn_cmdline_init("svnadmin", stderr) != EXIT_SUCCESS)
@@ -2555,7 +2546,17 @@ main(int argc, const char *argv[])
*/
pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE));
- exit_code = sub_main(argc, argv, pool);
+ err = sub_main(&exit_code, argc, argv, pool);
+
+ /* Flush stdout and report if it fails. It would be flushed on exit anyway
+ but this makes sure that output is not silently lost if it fails. */
+ err = svn_error_compose_create(err, svn_cmdline_fflush(stdout));
+
+ if (err)
+ {
+ exit_code = EXIT_FAILURE;
+ svn_cmdline_handle_exit_error(err, NULL, "svnadmin: ");
+ }
svn_pool_destroy(pool);
return exit_code;
Modified: subversion/branches/fsfs-improvements/subversion/svnauth/svnauth.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/svnauth/svnauth.c?rev=1545955&r1=1545954&r2=1545955&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/svnauth/svnauth.c (original)
+++ subversion/branches/fsfs-improvements/subversion/svnauth/svnauth.c Wed Nov 27 07:53:29 2013
@@ -872,24 +872,13 @@ subcommand_delete(apr_getopt_t *os, void
}
-/* Report and clear the error ERR, and return EXIT_FAILURE. */
-#define EXIT_ERROR(err) \
- svn_cmdline_handle_exit_error(err, NULL, "svnauth: ")
-
-/* A redefinition of the public SVN_INT_ERR macro, that suppresses the
- * error message if it is SVN_ERR_IO_PIPE_WRITE_ERROR, amd with the
- * program name 'svnauth' instead of 'svn'. */
-#undef SVN_INT_ERR
-#define SVN_INT_ERR(expr) \
- do { \
- svn_error_t *svn_err__temp = (expr); \
- if (svn_err__temp) \
- return EXIT_ERROR(svn_err__temp); \
- } while (0)
-
-
-static int
-sub_main(int argc, const char *argv[], apr_pool_t *pool)
+/*
+ * On success, leave *EXIT_CODE untouched and return SVN_NO_ERROR. On error,
+ * either return an error to be displayed, or set *EXIT_CODE to non-zero and
+ * return SVN_NO_ERROR.
+ */
+static svn_error_t *
+sub_main(int *exit_code, int argc, const char *argv[], apr_pool_t *pool)
{
svn_error_t *err;
const svn_opt_subcommand_desc2_t *subcommand = NULL;
@@ -898,12 +887,13 @@ sub_main(int argc, const char *argv[], a
if (argc <= 1)
{
- SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
- return EXIT_FAILURE;
+ SVN_ERR(subcommand_help(NULL, NULL, pool));
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
/* Parse options. */
- SVN_INT_ERR(svn_cmdline__getopt_init(&os, argc, argv, pool));
+ SVN_ERR(svn_cmdline__getopt_init(&os, argc, argv, pool));
os->interleave = 1;
while (1)
@@ -919,8 +909,9 @@ sub_main(int argc, const char *argv[], a
break;
else if (apr_err)
{
- SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
- return EXIT_FAILURE;
+ SVN_ERR(subcommand_help(NULL, NULL, pool));
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
switch (opt_id) {
@@ -929,7 +920,7 @@ sub_main(int argc, const char *argv[], a
opt_state.help = TRUE;
break;
case opt_config_dir:
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
opt_state.config_dir = svn_dirent_internal_style(utf8_opt_arg, pool);
break;
case opt_show_passwords:
@@ -940,8 +931,9 @@ sub_main(int argc, const char *argv[], a
break;
default:
{
- SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
- return EXIT_FAILURE;
+ SVN_ERR(subcommand_help(NULL, NULL, pool));
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
}
}
@@ -970,8 +962,9 @@ sub_main(int argc, const char *argv[], a
{
svn_error_clear(svn_cmdline_fprintf(stderr, pool,
_("subcommand argument required\n")));
- SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
- return EXIT_FAILURE;
+ SVN_ERR(subcommand_help(NULL, NULL, pool));
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
}
else
@@ -981,19 +974,20 @@ sub_main(int argc, const char *argv[], a
if (subcommand == NULL)
{
const char *first_arg_utf8;
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8,
- first_arg, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8,
+ first_arg, pool));
svn_error_clear(
svn_cmdline_fprintf(stderr, pool,
_("Unknown subcommand: '%s'\n"),
first_arg_utf8));
- SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
- return EXIT_FAILURE;
+ SVN_ERR(subcommand_help(NULL, NULL, pool));
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
}
}
- SVN_INT_ERR(svn_config_ensure(opt_state.config_dir, pool));
+ SVN_ERR(svn_config_ensure(opt_state.config_dir, pool));
/* Run the subcommand. */
err = (*subcommand->cmd_func)(os, &opt_state, pool);
@@ -1007,28 +1001,18 @@ sub_main(int argc, const char *argv[], a
err = svn_error_quick_wrap(err,
_("Try 'svnauth help' for more info"));
}
- return EXIT_ERROR(err);
- }
- else
- {
- /* Ensure that everything is written to stdout, so the user will
- see any print errors. */
- err = svn_cmdline_fflush(stdout);
- if (err)
- {
- return EXIT_ERROR(err);
- }
- return EXIT_SUCCESS;
+ return err;
}
- return EXIT_SUCCESS;
+ return SVN_NO_ERROR;
}
int
main(int argc, const char *argv[])
{
apr_pool_t *pool;
- int exit_code;
+ int exit_code = EXIT_SUCCESS;
+ svn_error_t *err;
/* Initialize the app. */
if (svn_cmdline_init("svnauth", stderr) != EXIT_SUCCESS)
@@ -1039,7 +1023,17 @@ main(int argc, const char *argv[])
*/
pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE));
- exit_code = sub_main(argc, argv, pool);
+ err = sub_main(&exit_code, argc, argv, pool);
+
+ /* Flush stdout and report if it fails. It would be flushed on exit anyway
+ but this makes sure that output is not silently lost if it fails. */
+ err = svn_error_compose_create(err, svn_cmdline_fflush(stdout));
+
+ if (err)
+ {
+ exit_code = EXIT_FAILURE;
+ svn_cmdline_handle_exit_error(err, NULL, "svnauth: ");
+ }
svn_pool_destroy(pool);
return exit_code;
Modified: subversion/branches/fsfs-improvements/subversion/svndumpfilter/svndumpfilter.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/svndumpfilter/svndumpfilter.c?rev=1545955&r1=1545954&r2=1545955&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/svndumpfilter/svndumpfilter.c (original)
+++ subversion/branches/fsfs-improvements/subversion/svndumpfilter/svndumpfilter.c Wed Nov 27 07:53:29 2013
@@ -1355,12 +1355,16 @@ subcommand_include(apr_getopt_t *os, voi
/** Main. **/
-int
-main(int argc, const char *argv[])
+/*
+ * On success, leave *EXIT_CODE untouched and return SVN_NO_ERROR. On error,
+ * either return an error to be displayed, or set *EXIT_CODE to non-zero and
+ * return SVN_NO_ERROR.
+ */
+static svn_error_t *
+sub_main(int *exit_code, int argc, const char *argv[], apr_pool_t *pool)
{
svn_error_t *err;
apr_status_t apr_err;
- apr_pool_t *pool;
const svn_opt_subcommand_desc2_t *subcommand = NULL;
struct svndumpfilter_opt_state opt_state;
@@ -1369,33 +1373,19 @@ main(int argc, const char *argv[])
apr_array_header_t *received_opts;
int i;
-
- /* Initialize the app. */
- if (svn_cmdline_init("svndumpfilter", stderr) != EXIT_SUCCESS)
- return EXIT_FAILURE;
-
- /* Create our top-level pool. Use a separate mutexless allocator,
- * given this application is single threaded.
- */
- pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE));
-
/* Check library versions */
- err = check_lib_versions();
- if (err)
- return svn_cmdline_handle_exit_error(err, pool, "svndumpfilter: ");
+ SVN_ERR(check_lib_versions());
received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int));
/* Initialize the FS library. */
- err = svn_fs_initialize(pool);
- if (err)
- return svn_cmdline_handle_exit_error(err, pool, "svndumpfilter: ");
+ SVN_ERR(svn_fs_initialize(pool));
if (argc <= 1)
{
- SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
- svn_pool_destroy(pool);
- return EXIT_FAILURE;
+ SVN_ERR(subcommand_help(NULL, NULL, pool));
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
/* Initialize opt_state. */
@@ -1404,9 +1394,7 @@ main(int argc, const char *argv[])
opt_state.end_revision.kind = svn_opt_revision_unspecified;
/* Parse options. */
- err = svn_cmdline__getopt_init(&os, argc, argv, pool);
- if (err)
- return svn_cmdline_handle_exit_error(err, pool, "svndumpfilter: ");
+ SVN_ERR(svn_cmdline__getopt_init(&os, argc, argv, pool));
os->interleave = 1;
while (1)
@@ -1419,9 +1407,9 @@ main(int argc, const char *argv[])
break;
else if (apr_err)
{
- SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
- svn_pool_destroy(pool);
- return EXIT_FAILURE;
+ SVN_ERR(subcommand_help(NULL, NULL, pool));
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
/* Stash the option code in an array before parsing it. */
@@ -1462,9 +1450,9 @@ main(int argc, const char *argv[])
break;
default:
{
- SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
- svn_pool_destroy(pool);
- return EXIT_FAILURE;
+ SVN_ERR(subcommand_help(NULL, NULL, pool));
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
} /* close `switch' */
} /* close `while' */
@@ -1473,10 +1461,10 @@ main(int argc, const char *argv[])
--drop-all-empty-revs. */
if (opt_state.drop_empty_revs && opt_state.drop_all_empty_revs)
{
- err = svn_error_create(SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL,
- _("--drop-empty-revs cannot be used with "
- "--drop-all-empty-revs"));
- return svn_cmdline_handle_exit_error(err, pool, "svndumpfilter: ");
+ return svn_error_create(SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS,
+ NULL,
+ _("--drop-empty-revs cannot be used with "
+ "--drop-all-empty-revs"));
}
/* If the user asked for help, then the rest of the arguments are
@@ -1508,9 +1496,9 @@ main(int argc, const char *argv[])
svn_error_clear(svn_cmdline_fprintf
(stderr, pool,
_("Subcommand argument required\n")));
- SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
- svn_pool_destroy(pool);
- return EXIT_FAILURE;
+ SVN_ERR(subcommand_help(NULL, NULL, pool));
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
}
else
@@ -1520,18 +1508,16 @@ main(int argc, const char *argv[])
if (subcommand == NULL)
{
const char* first_arg_utf8;
- if ((err = svn_utf_cstring_to_utf8(&first_arg_utf8, first_arg,
- pool)))
- return svn_cmdline_handle_exit_error(err, pool,
- "svndumpfilter: ");
+ SVN_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8, first_arg,
+ pool));
svn_error_clear(
svn_cmdline_fprintf(stderr, pool,
_("Unknown subcommand: '%s'\n"),
first_arg_utf8));
- SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
- svn_pool_destroy(pool);
- return EXIT_FAILURE;
+ SVN_ERR(subcommand_help(NULL, NULL, pool));
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
}
}
@@ -1551,7 +1537,7 @@ main(int argc, const char *argv[])
/* Ensure that each prefix is UTF8-encoded, in internal
style, and absolute. */
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&prefix, os->argv[i], pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&prefix, os->argv[i], pool));
prefix = svn_relpath__internal_style(prefix, pool);
if (prefix[0] != '/')
prefix = apr_pstrcat(pool, "/", prefix, SVN_VA_NULL);
@@ -1569,12 +1555,12 @@ main(int argc, const char *argv[])
the targets into an array, because otherwise we wouldn't
know what delimiter to use for svn_cstring_split(). */
- SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_targets_file,
- opt_state.targets_file, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_targets_file,
+ opt_state.targets_file, pool));
- SVN_INT_ERR(svn_stringbuf_from_file2(&buffer, utf8_targets_file,
- pool));
- SVN_INT_ERR(svn_utf_stringbuf_to_utf8(&buffer_utf8, buffer, pool));
+ SVN_ERR(svn_stringbuf_from_file2(&buffer, utf8_targets_file,
+ pool));
+ SVN_ERR(svn_utf_stringbuf_to_utf8(&buffer_utf8, buffer, pool));
targets = apr_array_append(pool,
svn_cstring_split(buffer_utf8->data, "\n\r",
@@ -1595,8 +1581,8 @@ main(int argc, const char *argv[])
svn_error_clear(svn_cmdline_fprintf
(stderr, pool,
_("\nError: no prefixes supplied.\n")));
- svn_pool_destroy(pool);
- return EXIT_FAILURE;
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
}
@@ -1621,15 +1607,15 @@ main(int argc, const char *argv[])
pool);
svn_opt_format_option(&optstr, badopt, FALSE, pool);
if (subcommand->name[0] == '-')
- SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
+ SVN_ERR(subcommand_help(NULL, NULL, pool));
else
svn_error_clear(svn_cmdline_fprintf
(stderr, pool,
_("Subcommand '%s' doesn't accept option '%s'\n"
"Type 'svndumpfilter help %s' for usage.\n"),
subcommand->name, optstr, subcommand->name));
- svn_pool_destroy(pool);
- return EXIT_FAILURE;
+ *exit_code = EXIT_FAILURE;
+ return SVN_NO_ERROR;
}
}
@@ -1646,14 +1632,40 @@ main(int argc, const char *argv[])
_("Try 'svndumpfilter help' for more "
"info"));
}
- return svn_cmdline_handle_exit_error(err, pool, "svndumpfilter: ");
+ return err;
}
- else
- {
- svn_pool_destroy(pool);
- /* Flush stdout, making sure the user will see any print errors. */
- SVN_INT_ERR(svn_cmdline_fflush(stdout));
- return EXIT_SUCCESS;
+ return SVN_NO_ERROR;
+}
+
+int
+main(int argc, const char *argv[])
+{
+ apr_pool_t *pool;
+ int exit_code = EXIT_SUCCESS;
+ svn_error_t *err;
+
+ /* Initialize the app. */
+ if (svn_cmdline_init("svndumpfilter", stderr) != EXIT_SUCCESS)
+ return EXIT_FAILURE;
+
+ /* Create our top-level pool. Use a separate mutexless allocator,
+ * given this application is single threaded.
+ */
+ pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE));
+
+ err = sub_main(&exit_code, argc, argv, pool);
+
+ /* Flush stdout and report if it fails. It would be flushed on exit anyway
+ but this makes sure that output is not silently lost if it fails. */
+ err = svn_error_compose_create(err, svn_cmdline_fflush(stdout));
+
+ if (err)
+ {
+ exit_code = EXIT_FAILURE;
+ svn_cmdline_handle_exit_error(err, NULL, "svndumpfilter: ");
}
+
+ svn_pool_destroy(pool);
+ return exit_code;
}