Hi all,
Currently svnadmin, svnlook, svnsync, svndumpfilter, svnversion,
svnserve show the entire version information even if '--version --quiet'
is given as command.
The '--quiet' option has *not* been handled so far.
This patch would make svnadmin, svnlook, svnsync, svndumpfilter,
svnversion, svnserve '--version --quiet' to display *only* the version
number(info) just like 'svn --version --quiet' does.
I have attached the patch and the log message with this mail. Please
give your views on this.
Thanks and regards
Prabhu
[[[
svnadmin, svnlook, svnserve, svnversion, svnsync, svndumpfilter, svnrdump would now show the version documentation in quiet mode similar to 'svn'.
* subversion/svndumpfilter/main.c
(subcommand_help): now accepts the 'quiet' option.
(main): added a 'break' statement.
help subcommand handles the '--quiet' option along with '--version'.
* subversion/svnversion/main.c
(version): accepts the 'quiet' option and displays the version in quiet mode also.
(main) : added booleans 'quiet' and 'is_version'.
added 'quiet' to the 'options'.
handles the 'quiet' case.
* subversion/svnadmin/main.c
(subcommand_help): handles the 'quiet' option.
(main): help subcommand handles the '--quiet' option along with '--version'.
* subversion/svnlook/main.c
(): added 'quiet' to the 'options_table'.
(struct svnlook_opt_state): added boolean 'quiet'.
(subcommand_help): handles the 'quiet' option.
(main): handled the 'quiet' case.
help subcommand handles the '--quiet' option along with '--version'.
* subversion/svnsync/main.c
(help_cmd): handles the 'quiet' option.
(main) : help subcommand handles the '--quiet' option along with '--version'.
* subversion/svnserve/main.c
(): added 'quiet' to the svnserve__options.
(version): now accepts 'quiet' argument and handles the 'quiet' option.
(main): added booleans 'quiet' and 'is_version'.
handles the 'quiet' case.
pass the 'quiet' option to version() function.
* subversion/svnrdump/svnrdump.c
(version): now accepts the 'baton' argument.
svn_opt_print_help3() function handles the 'quiet' option.
(main) : help subcommand handles the '--quiet' option along with '--version'.
Patch by: Prabhu Gnana Sundar <prabhugs{_AT_}collab.net>
Suggested by: Kamesh Jayachandran <kamesh{_AT_}collab.net>
]]]
Index: subversion/svndumpfilter/main.c
===================================================================
--- subversion/svndumpfilter/main.c (revision 1055432)
+++ subversion/svndumpfilter/main.c (working copy)
@@ -1054,7 +1054,7 @@
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 @@
break;
case svndumpfilter__version:
opt_state.version = TRUE;
+ break;
case svndumpfilter__quiet:
opt_state.quiet = TRUE;
break;
@@ -1385,6 +1386,7 @@
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;
Index: subversion/svnversion/main.c
===================================================================
--- subversion/svnversion/main.c (revision 1055432)
+++ subversion/svnversion/main.c (working copy)
@@ -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 @@
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 @@
{"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 @@
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 @@
}
}
+ if(is_version)
+ {
+ SVN_INT_ERR(version(quiet, pool));
+ exit(0);
+ }
if (os->ind > argc || os->ind < argc - 2)
{
usage(pool);
Index: subversion/svnadmin/main.c
===================================================================
--- subversion/svnadmin/main.c (revision 1055432)
+++ subversion/svnadmin/main.c (working copy)
@@ -926,7 +926,8 @@
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 @@
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;
Index: subversion/svnlook/main.c
===================================================================
--- subversion/svnlook/main.c (revision 1055432)
+++ subversion/svnlook/main.c (working copy)
@@ -176,6 +176,9 @@
" "
" Ignore changes in EOL style")},
+ {"quiet", 'q', 0,
+ N_("no progress (only errors) to stderr")},
+
{0, 0, 0, 0}
};
@@ -310,6 +313,7 @@
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 @@
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 @@
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 @@
static const svn_opt_subcommand_desc2_t pseudo_cmd =
{ "--version", subcommand_help, {0}, "",
{svnlook__version, /* must accept its own option */
+ 'q',
} };
subcommand = &pseudo_cmd;
Index: subversion/svnsync/main.c
===================================================================
--- subversion/svnsync/main.c (revision 1055432)
+++ subversion/svnsync/main.c (working copy)
@@ -1681,7 +1681,8 @@
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 @@
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;
Index: subversion/svnserve/main.c
===================================================================
--- subversion/svnserve/main.c (revision 1055432)
+++ subversion/svnserve/main.c (working copy)
@@ -218,6 +218,8 @@
{"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 @@
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 @@
_("\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 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 @@
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 @@
}
}
+
+ if (is_version)
+ {
+ SVN_INT_ERR(version(quiet, pool));
+ exit(0);
+ }
+
if (os->ind != argc)
usage(argv[0], pool);
Index: subversion/svnrdump/svnrdump.c
===================================================================
--- subversion/svnrdump/svnrdump.c (revision 1055432)
+++ subversion/svnrdump/svnrdump.c (working copy)
@@ -484,8 +484,10 @@
*/
static svn_error_t *
version(const char *progname,
+ void *baton,
apr_pool_t *pool)
{
+ opt_baton_t *opt_baton = baton;
svn_stringbuf_t *version_footer =
svn_stringbuf_create(_("The following repository access (RA) modules "
"are available:\n\n"),
@@ -493,7 +495,8 @@
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, opt_baton ? opt_baton->quiet : FALSE,
+ version_footer->data,
NULL, NULL, NULL, NULL, NULL, pool);
}
@@ -796,6 +799,7 @@
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 +867,7 @@
if (subcommand && strcmp(subcommand->name, "--version") == 0)
{
- SVNRDUMP_ERR(version(argv[0], pool));
+ SVNRDUMP_ERR(version(argv[0], opt_baton, pool));
svn_pool_destroy(pool);
exit(EXIT_SUCCESS);
}