On 25.02.2015 12:34, Philip Martin wrote: > Branko Čibej <br...@wandisco.com> writes: > >> On 25.02.2015 12:10, Philip Martin wrote: >>> Branko Čibej <br...@wandisco.com> writes: >>> >>>> The new variant of 'svn info' is called >>>> >>>> svn info --show-item=KEYWORD >>>> >>>> (it also accepts --no-newline, just like 'svn youngest' did). >>> 'svn propget' has a much longer history of using --strict to suppress >>> the newline. >> Yes, but what are you suggesting, that I add the '--strict' option to >> 'svn info'? Because I have trouble imagining how that would be >> understandable to users. > I am suggesting that --no-newline should be replaced by --strict. Is it > harder to understand when used with 'info' than it is when used with > 'propget'? It seems odd for different sub-commands to use different > names for what is essentially the same option. > > 'svn youngest' is not a precedent for using --no-newline in 'svn' as it > was never released. 'svnversion' does use '--no-newline' but it is not > 'svn' and it also has '-c' that conflicts with 'svn'.
I'm changing the subject here because this --no-newline vs. --strict debate really has nothing to do with 'svn info --show-item'. To illustrate how absurd the current state is (this is on the svn-info-detail branch): $ grep -n opt_no_newline subversion/svn/svn.c 146: opt_no_newline, 421: {"no-newline", opt_no_newline, 0, N_("do not output the trailing newline")}, 759: opt_changelist, opt_include_externals, opt_show_item, opt_no_newline} 2418: case opt_no_newline: $ grep -n opt_strict subversion/svn/svn.c 113: opt_strict, 236: {"strict", opt_strict, 0, N_("use strict semantics")}, 1380: {'v', 'R', opt_depth, 'r', opt_revprop, opt_strict, opt_xml, 1383: {opt_strict, N_("don't print an extra newline")}} }, 2175: case opt_strict: We have two options, one called --strict and another called --no-newline (the latter is new on trunk). Both are used exactly once. The single usage of the --strict option is arguably complete nonsense: the default docstring, which isn't displayed *anywhere*, is 'use strict semantics' and ... means nothing at all. In actual usage, --strict is hardly mnemonic for not printing trailing newlines. Given all that, I propose we deprecate --strict and conflate the actual option value with --no-newline, like this (this is trunk, untested): [[[ Index: subversion/svn/cl.h =================================================================== --- subversion/svn/cl.h (revision 1662202) +++ subversion/svn/cl.h (working copy) @@ -167,7 +167,6 @@ typedef struct svn_cl__opt_state_t svn_boolean_t version; /* print version information */ svn_boolean_t verbose; /* be verbose */ svn_boolean_t update; /* contact the server for the full story */ - svn_boolean_t strict; /* do strictly what was requested */ svn_stringbuf_t *filedata; /* contents of file used as option data (not converted to UTF-8) */ const char *encoding; /* the locale/encoding of 'message' and of Index: subversion/svn/propget-cmd.c =================================================================== --- subversion/svn/propget-cmd.c (revision 1662202) +++ subversion/svn/propget-cmd.c (working copy) @@ -322,11 +322,11 @@ svn_cl__propget(apr_getopt_t *os, svn_stream_t *out; svn_boolean_t warned = FALSE; - if (opt_state->verbose && (opt_state->revprop || opt_state->strict + if (opt_state->verbose && (opt_state->revprop || opt_state->no_newline || opt_state->xml)) return svn_error_create(SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL, _("--verbose cannot be used with --revprop or " - "--strict or --xml")); + "--no-newline or --xml")); /* PNAME is first argument (and PNAME_UTF8 will be a UTF-8 version thereof) */ @@ -411,7 +411,7 @@ svn_cl__propget(apr_getopt_t *os, SVN_ERR(stream_write(out, printable_val->data, printable_val->len)); - if (! opt_state->strict) + if (! opt_state->no_newline) SVN_ERR(stream_write(out, APR_EOL_STR, strlen(APR_EOL_STR))); } } @@ -427,16 +427,17 @@ svn_cl__propget(apr_getopt_t *os, if (opt_state->depth == svn_depth_unknown) opt_state->depth = svn_depth_empty; - /* Strict mode only makes sense for a single target. So make + /* No-newline mode only makes sense for a single target. So make sure we have only a single target, and that we're not being asked to recurse on that target. */ - if (opt_state->strict + if (opt_state->no_newline && ((targets->nelts > 1) || (opt_state->depth != svn_depth_empty) || (opt_state->show_inherited_props))) return svn_error_create (SVN_ERR_CL_ARG_PARSING_ERROR, NULL, - _("Strict output of property values only available for single-" - "target, non-recursive propget operations")); + _("Output of property values without a trailing newline" + " is only available for single-target, non-recursive" + " propget operations")); for (i = 0; i < targets->nelts; i++) { @@ -472,15 +473,15 @@ svn_cl__propget(apr_getopt_t *os, /* Any time there is more than one thing to print, or where the path associated with a printed thing is not obvious, we'll print filenames. That is, unless we've been told - not to do so with the --strict option. */ + not to do so with the --no-newline option. */ print_filenames = ((opt_state->depth > svn_depth_empty || targets->nelts > 1 || apr_hash_count(props) > 1 || opt_state->verbose || opt_state->show_inherited_props) - && (! opt_state->strict)); - omit_newline = opt_state->strict; - like_proplist = opt_state->verbose && !opt_state->strict; + && (! opt_state->no_newline)); + omit_newline = opt_state->no_newline; + like_proplist = opt_state->verbose && !opt_state->no_newline; /* If there are no properties, and exactly one node was queried, then warn. */ Index: subversion/svn/svn.c =================================================================== --- subversion/svn/svn.c (revision 1662202) +++ subversion/svn/svn.c (working copy) @@ -110,7 +110,7 @@ typedef enum svn_cl__longopt_t { opt_remove, opt_revprop, opt_stop_on_copy, - opt_strict, + opt_strict, /* ### DEPRECATED */ opt_targets, opt_depth, opt_set_depth, @@ -232,7 +232,7 @@ const apr_getopt_option_t svn_cl__options[] = " " "'empty', 'files', 'immediates', or 'infinity')")}, {"xml", opt_xml, 0, N_("output in XML")}, - {"strict", opt_strict, 0, N_("use strict semantics")}, + {"strict", opt_strict, 0, N_("DEPRECATED")}, {"stop-on-copy", opt_stop_on_copy, 0, N_("do not cross copies while traversing history")}, {"no-ignore", opt_no_ignore, 0, @@ -1355,14 +1355,14 @@ const svn_opt_subcommand_desc2_t svn_cl__cmd_table "\n" " By default, an extra newline is printed after the property value so that\n" " the output looks pretty. With a single TARGET, depth 'empty' and without\n" - " --show-inherited-props, you can use the --strict option to disable this\n" + " --show-inherited-props, you can use the --no-newline option to disable this\n" " (useful when redirecting a binary property value to a file, for example).\n" "\n" " See 'svn help propset' for descriptions of the svn:* special properties.\n"), - {'v', 'R', opt_depth, 'r', opt_revprop, opt_strict, opt_xml, + {'v', 'R', opt_depth, 'r', opt_revprop, opt_strict, opt_no_newline, opt_xml, opt_changelist, opt_show_inherited_props }, {{'v', N_("print path, name and value on separate lines")}, - {opt_strict, N_("don't print an extra newline")}} }, + {opt_strict, N_("(deprecated; use --no-newline)")}} }, { "proplist", svn_cl__proplist, {"plist", "pl"}, N_ ("List all properties on files, dirs, or revisions.\n" @@ -2154,9 +2154,6 @@ sub_main(int *exit_code, int argc, const char *arg case opt_stop_on_copy: opt_state.stop_on_copy = TRUE; break; - case opt_strict: - opt_state.strict = TRUE; - break; case opt_no_ignore: opt_state.no_ignore = TRUE; break; @@ -2398,6 +2395,7 @@ sub_main(int *exit_code, int argc, const char *arg opt_state.remove_ignored = TRUE; break; case opt_no_newline: + case opt_strict: /* ### DEPRECATED */ opt_state.no_newline = TRUE; break; case opt_show_passwords: Index: subversion/tests/cmdline/checkout_tests.py =================================================================== --- subversion/tests/cmdline/checkout_tests.py (revision 1662202) +++ subversion/tests/cmdline/checkout_tests.py (working copy) @@ -662,7 +662,7 @@ def checkout_peg_rev_date(sbox): ## Get svn:date. exit_code, output, errput = svntest.main.run_svn(None, 'propget', 'svn:date', '--revprop', '-r1', - '--strict', + '--no-newline', sbox.repo_url) if exit_code or errput != [] or len(output) != 1: raise svntest.Failure("svn:date propget failed") Index: subversion/tests/cmdline/prop_tests.py =================================================================== --- subversion/tests/cmdline/prop_tests.py (revision 1662202) +++ subversion/tests/cmdline/prop_tests.py (working copy) @@ -2611,7 +2611,7 @@ def peg_rev_base_working(sbox): sbox.simple_commit(message='r2') svntest.actions.set_prop('cardinal', 'nine\n', sbox.ospath('iota')) svntest.actions.run_and_verify_svn(['ninth\n'], [], - 'propget', '--strict', 'ordinal', + 'propget', '--no-newline', 'ordinal', sbox.ospath('iota') + '@BASE') @Issue(4415) @@ -2644,7 +2644,7 @@ def xml_unsafe_author(sbox): # a single property value which skips creating the creator-displayname property svntest.actions.run_and_verify_svn(['foo\bbar'], [], 'propget', '--revprop', '-r', '1', - 'svn:author', '--strict', wc_dir) + 'svn:author', '--no-newline', wc_dir) # Ensure a stable date svntest.actions.run_and_verify_svn(None, [], Index: subversion/tests/cmdline/special_tests.py =================================================================== --- subversion/tests/cmdline/special_tests.py (revision 1662202) +++ subversion/tests/cmdline/special_tests.py (working copy) @@ -705,7 +705,7 @@ def propvalue_normalized(sbox): # Property value should be SVN_PROP_BOOLEAN_TRUE expected_propval = ['*'] svntest.actions.run_and_verify_svn(expected_propval, [], - 'propget', '--strict', 'svn:special', + 'propget', '--no-newline', 'svn:special', iota2_path) # Commit and check again. @@ -722,7 +722,7 @@ def propvalue_normalized(sbox): svntest.main.run_svn(None, 'update', wc_dir) svntest.actions.run_and_verify_svn(expected_propval, [], - 'propget', '--strict', 'svn:special', + 'propget', '--no-newline', 'svn:special', iota2_path) Index: subversion/tests/cmdline/svnmucc_tests.py =================================================================== --- subversion/tests/cmdline/svnmucc_tests.py (revision 1662202) +++ subversion/tests/cmdline/svnmucc_tests.py (working copy) @@ -345,7 +345,7 @@ def propset_root_internal(sbox, target): 'propset', 'foo', 'bar', target) svntest.actions.run_and_verify_svn('bar', [], - 'propget', '--strict', 'foo', + 'propget', '--no-newline', 'foo', target) ## propdel on ^/ @@ -355,7 +355,7 @@ def propset_root_internal(sbox, target): target) svntest.actions.run_and_verify_svn([], '.*W200017: Property.*not found', - 'propget', '--strict', 'foo', + 'propget', '--no-newline', 'foo', target) @Issues(3663) Index: subversion/tests/cmdline/trans_tests.py =================================================================== --- subversion/tests/cmdline/trans_tests.py (revision 1662202) +++ subversion/tests/cmdline/trans_tests.py (working copy) @@ -680,7 +680,7 @@ def cat_keyword_expansion(sbox): sbox.wc_dir) svntest.actions.run_and_verify_svn([ full_author ], [], 'propget', '--revprop', '-r2', - 'svn:author', '--strict', + 'svn:author', '--no-newline', sbox.wc_dir) # Make another commit so that the last changed revision for A/mu is ]]] -- Brane