You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2011/01/05 16:01:53 UTC
svn commit: r1055478 - in /subversion/trunk/subversion: svnadmin/main.c
svndumpfilter/main.c svnlook/main.c svnrdump/svnrdump.c svnserve/main.c
svnsync/main.c svnversion/main.c
Author: cmpilato
Date: Wed Jan 5 15:01:52 2011
New Revision: 1055478
URL: http://svn.apache.org/viewvc?rev=1055478&view=rev
Log:
Teach the --version output from svnadmin, svnlook, svnserve,
svnversion, svnsync, svndumpfilter, and svnrdump to accept --quiet,
which forces display of *only* the version number (the way 'svn
--version --quiet' behaves).
* subversion/svndumpfilter/main.c
(subcommand_help): Pass option baton 'quiet' state to
svn_opt_print_help3().
(main): Handle the --quiet option when supplied with --version.
* subversion/svnversion/main.c
(version): Add 'quiet' parameter, passed to svn_opt_print_help3().
(main): Delay handling of --version until all options are parsed,
and pass --quiet state to updated call to version().
* subversion/svnadmin/main.c
(subcommand_help): Pass option baton 'quiet' state to
svn_opt_print_help3().
(main): Handle the --quiet option when supplied with --version.
* subversion/svnlook/main.c
(options_table): Add support for --quiet/-q.
(struct svnlook_opt_state): Add 'quiet' boolean member.
(subcommand_help): Pass option baton 'quiet' state to
svn_opt_print_help3().
(main): Handled the --quiet/-q option in general, and specifically when
supplied with --version.
* subversion/svnsync/main.c
(help_cmd): Pass option baton 'quiet' state to svn_opt_print_help3().
(main): Handle the --quiet option when supplied with --version.
* subversion/svnserve/main.c
(svnserve__options): Add --quiet/-q option.
(version): Add 'quiet' parameter, passed to svn_opt_print_help3().
(main): Delay handling of --version until all options are parsed,
and pass --quiet state to updated call to version().
* subversion/svnrdump/svnrdump.c
(version): Add 'quiet' parameter, passed to svn_opt_print_help3().
(main): Handle the --quiet option when supplied with --version.
Suggested by: kameshj
Patch by: Prabhu Gnana Sundar <pr...@collab.net>
(Tweaked by me.)
Modified:
subversion/trunk/subversion/svnadmin/main.c
subversion/trunk/subversion/svndumpfilter/main.c
subversion/trunk/subversion/svnlook/main.c
subversion/trunk/subversion/svnrdump/svnrdump.c
subversion/trunk/subversion/svnserve/main.c
subversion/trunk/subversion/svnsync/main.c
subversion/trunk/subversion/svnversion/main.c
Modified: subversion/trunk/subversion/svnadmin/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnadmin/main.c?rev=1055478&r1=1055477&r2=1055478&view=diff
==============================================================================
--- subversion/trunk/subversion/svnadmin/main.c (original)
+++ subversion/trunk/subversion/svnadmin/main.c Wed Jan 5 15:01:52 2011
@@ -926,7 +926,8 @@ subcommand_help(apr_getopt_t *os, void *
SVN_ERR(svn_opt_print_help3(os, "svnadmin",
opt_state ? opt_state->version : FALSE,
- FALSE, version_footer->data,
+ opt_state ? opt_state->quiet : FALSE,
+ version_footer->data,
header, cmd_table, options_table, NULL, NULL,
pool));
@@ -1766,6 +1767,7 @@ main(int argc, const char *argv[])
static const svn_opt_subcommand_desc2_t pseudo_cmd =
{ "--version", subcommand_help, {0}, "",
{svnadmin__version, /* must accept its own option */
+ 'q', /* --quiet */
} };
subcommand = &pseudo_cmd;
Modified: subversion/trunk/subversion/svndumpfilter/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svndumpfilter/main.c?rev=1055478&r1=1055477&r2=1055478&view=diff
==============================================================================
--- subversion/trunk/subversion/svndumpfilter/main.c (original)
+++ subversion/trunk/subversion/svndumpfilter/main.c Wed Jan 5 15:01:52 2011
@@ -1054,7 +1054,7 @@ subcommand_help(apr_getopt_t *os, void *
SVN_ERR(svn_opt_print_help3(os, "svndumpfilter",
opt_state ? opt_state->version : FALSE,
- FALSE, NULL,
+ opt_state ? opt_state->quiet : FALSE, NULL,
header, cmd_table, options_table, NULL,
NULL, pool));
@@ -1336,6 +1336,7 @@ main(int argc, const char *argv[])
break;
case svndumpfilter__version:
opt_state.version = TRUE;
+ break;
case svndumpfilter__quiet:
opt_state.quiet = TRUE;
break;
@@ -1385,6 +1386,7 @@ main(int argc, const char *argv[])
static const svn_opt_subcommand_desc2_t pseudo_cmd =
{ "--version", subcommand_help, {0}, "",
{svndumpfilter__version, /* must accept its own option */
+ svndumpfilter__quiet,
} };
subcommand = &pseudo_cmd;
Modified: subversion/trunk/subversion/svnlook/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnlook/main.c?rev=1055478&r1=1055477&r2=1055478&view=diff
==============================================================================
--- subversion/trunk/subversion/svnlook/main.c (original)
+++ subversion/trunk/subversion/svnlook/main.c Wed Jan 5 15:01:52 2011
@@ -176,6 +176,9 @@ static const apr_getopt_option_t options
" "
" Ignore changes in EOL style")},
+ {"quiet", 'q', 0,
+ N_("no progress (only errors) to stderr")},
+
{0, 0, 0, 0}
};
@@ -310,6 +313,7 @@ struct svnlook_opt_state
svn_boolean_t non_recursive; /* --non-recursive */
svn_boolean_t xml; /* --xml */
const char *extensions; /* diff extension args (UTF-8!) */
+ svn_boolean_t quiet; /* --quiet */
};
@@ -2021,7 +2025,8 @@ subcommand_help(apr_getopt_t *os, void *
SVN_ERR(svn_opt_print_help3(os, "svnlook",
opt_state ? opt_state->version : FALSE,
- FALSE, version_footer->data,
+ opt_state ? opt_state->quiet : FALSE,
+ version_footer->data,
header, cmd_table, options_table, NULL,
NULL, pool));
@@ -2326,6 +2331,10 @@ main(int argc, const char *argv[])
opt_state.help = TRUE;
break;
+ case 'q':
+ opt_state.quiet = TRUE;
+ break;
+
case svnlook__revprop_opt:
opt_state.revprop = TRUE;
break;
@@ -2419,6 +2428,7 @@ main(int argc, const char *argv[])
static const svn_opt_subcommand_desc2_t pseudo_cmd =
{ "--version", subcommand_help, {0}, "",
{svnlook__version, /* must accept its own option */
+ 'q',
} };
subcommand = &pseudo_cmd;
Modified: subversion/trunk/subversion/svnrdump/svnrdump.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/svnrdump.c?rev=1055478&r1=1055477&r2=1055478&view=diff
==============================================================================
--- subversion/trunk/subversion/svnrdump/svnrdump.c (original)
+++ subversion/trunk/subversion/svnrdump/svnrdump.c Wed Jan 5 15:01:52 2011
@@ -484,6 +484,7 @@ usage(const char *progname,
*/
static svn_error_t *
version(const char *progname,
+ svn_boolean_t quiet,
apr_pool_t *pool)
{
svn_stringbuf_t *version_footer =
@@ -493,7 +494,7 @@ version(const char *progname,
SVN_ERR(svn_ra_print_modules(version_footer, pool));
return svn_opt_print_help3(NULL, ensure_appname(progname, pool),
- TRUE, FALSE, version_footer->data,
+ TRUE, quiet, version_footer->data,
NULL, NULL, NULL, NULL, NULL, pool);
}
@@ -796,6 +797,7 @@ main(int argc, const char **argv)
static const svn_opt_subcommand_desc2_t pseudo_cmd =
{ "--version", help_cmd, {0}, "",
{opt_version, /* must accept its own option */
+ 'q', /* --quiet */
} };
subcommand = &pseudo_cmd;
}
@@ -863,7 +865,7 @@ main(int argc, const char **argv)
if (subcommand && strcmp(subcommand->name, "--version") == 0)
{
- SVNRDUMP_ERR(version(argv[0], pool));
+ SVNRDUMP_ERR(version(argv[0], opt_baton->quiet, pool));
svn_pool_destroy(pool);
exit(EXIT_SUCCESS);
}
Modified: subversion/trunk/subversion/svnserve/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnserve/main.c?rev=1055478&r1=1055477&r2=1055478&view=diff
==============================================================================
--- subversion/trunk/subversion/svnserve/main.c (original)
+++ subversion/trunk/subversion/svnserve/main.c Wed Jan 5 15:01:52 2011
@@ -218,6 +218,8 @@ static const apr_getopt_option_t svnserv
{"help", 'h', 0, N_("display this help")},
{"version", SVNSERVE_OPT_VERSION, 0,
N_("show program version information")},
+ {"quiet", 'q', 0,
+ N_("no progress (only errors) to stderr")},
{0, 0, 0, 0}
};
@@ -260,7 +262,7 @@ static void help(apr_pool_t *pool)
exit(0);
}
-static svn_error_t * version(apr_pool_t *pool)
+static svn_error_t * version(svn_boolean_t quiet, apr_pool_t *pool)
{
const char *fs_desc_start
= _("The following repository back-end (FS) modules are available:\n\n");
@@ -275,7 +277,7 @@ static svn_error_t * version(apr_pool_t
_("\nCyrus SASL authentication is available.\n"));
#endif
- return svn_opt_print_help3(NULL, "svnserve", TRUE, FALSE, version_footer->data,
+ return svn_opt_print_help3(NULL, "svnserve", TRUE, quiet, version_footer->data,
NULL, NULL, NULL, NULL, NULL, pool);
}
@@ -393,6 +395,8 @@ int main(int argc, const char *argv[])
int family = APR_INET;
apr_int32_t sockaddr_info_flags = 0;
svn_boolean_t prefer_v6 = FALSE;
+ svn_boolean_t quiet = FALSE;
+ svn_boolean_t is_version = FALSE;
int mode_opt_count = 0;
const char *config_filename = NULL;
const char *pid_filename = NULL;
@@ -451,9 +455,12 @@ int main(int argc, const char *argv[])
help(pool);
break;
+ case 'q':
+ quiet = TRUE;
+ break;
+
case SVNSERVE_OPT_VERSION:
- SVN_INT_ERR(version(pool));
- exit(0);
+ is_version = TRUE;
break;
case 'd':
@@ -575,6 +582,13 @@ int main(int argc, const char *argv[])
}
}
+
+ if (is_version)
+ {
+ SVN_INT_ERR(version(quiet, pool));
+ exit(0);
+ }
+
if (os->ind != argc)
usage(argv[0], pool);
Modified: subversion/trunk/subversion/svnsync/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnsync/main.c?rev=1055478&r1=1055477&r2=1055478&view=diff
==============================================================================
--- subversion/trunk/subversion/svnsync/main.c (original)
+++ subversion/trunk/subversion/svnsync/main.c Wed Jan 5 15:01:52 2011
@@ -1681,7 +1681,8 @@ help_cmd(apr_getopt_t *os, void *baton,
SVN_ERR(svn_opt_print_help3(os, "svnsync",
opt_baton ? opt_baton->version : FALSE,
- FALSE, version_footer->data, header,
+ opt_baton ? opt_baton->quiet : FALSE,
+ version_footer->data, header,
svnsync_cmd_table, svnsync_options, NULL,
NULL, pool));
@@ -1961,6 +1962,7 @@ main(int argc, const char *argv[])
static const svn_opt_subcommand_desc2_t pseudo_cmd =
{ "--version", help_cmd, {0}, "",
{svnsync_opt_version, /* must accept its own option */
+ 'q', /* --quiet */
} };
subcommand = &pseudo_cmd;
Modified: subversion/trunk/subversion/svnversion/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnversion/main.c?rev=1055478&r1=1055477&r2=1055478&view=diff
==============================================================================
--- subversion/trunk/subversion/svnversion/main.c (original)
+++ subversion/trunk/subversion/svnversion/main.c Wed Jan 5 15:01:52 2011
@@ -32,9 +32,9 @@
static svn_error_t *
-version(apr_pool_t *pool)
+version(svn_boolean_t quiet, apr_pool_t *pool)
{
- return svn_opt_print_help3(NULL, "svnversion", TRUE, FALSE, NULL, NULL,
+ return svn_opt_print_help3(NULL, "svnversion", TRUE, quiet, NULL, NULL,
NULL, NULL, NULL, NULL, pool);
}
@@ -128,6 +128,8 @@ main(int argc, const char *argv[])
apr_getopt_t *os;
svn_node_kind_t kind;
svn_wc_context_t *wc_ctx;
+ svn_boolean_t quiet = FALSE;
+ svn_boolean_t is_version = FALSE;
const apr_getopt_option_t options[] =
{
{"no-newline", 'n', 0, N_("do not output the trailing newline")},
@@ -135,6 +137,8 @@ main(int argc, const char *argv[])
{"help", 'h', 0, N_("display this help")},
{"version", SVNVERSION_OPT_VERSION, 0,
N_("show program version information")},
+ {"quiet", 'q', 0,
+ N_("no progress (only errors) to stderr")},
{0, 0, 0, 0}
};
@@ -193,12 +197,14 @@ main(int argc, const char *argv[])
case 'c':
committed = TRUE;
break;
+ case 'q':
+ quiet = TRUE;
+ break;
case 'h':
help(options, pool);
break;
case SVNVERSION_OPT_VERSION:
- SVN_INT_ERR(version(pool));
- exit(0);
+ is_version = TRUE;
break;
default:
usage(pool);
@@ -206,6 +212,11 @@ main(int argc, const char *argv[])
}
}
+ if (is_version)
+ {
+ SVN_INT_ERR(version(quiet, pool));
+ exit(0);
+ }
if (os->ind > argc || os->ind < argc - 2)
{
usage(pool);