Checkout Tools
  • last updated 3 hours ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Adjust lifetime of the result returned from svn_repos__normalize_prop().

Previously, this function would make an unconditional copy of the value into

the result pool. While this may look convenient in some of the cases, there

is a downside of making unnecessary copies even if no normalization happened.

Instead of that, let's give the calling site control over the results' lifetime

by not making the copy if the input did not change. The callers may still dup()

the value if they need to, but with this approach there are no unavoidable

copies in various situations, such as where we would like to only update the

value if it changed or where we don't have an appropriate scratch pool, but

need to normalize the property value anyway.

* subversion/include/private/svn_repos_private.h

(svn_repos__normalize_prop): Adjust documentation.

* subversion/libsvn_repos/fs-wrap.c

(svn_repos__normalize_prop): Do not duplicate the input if no normalization

is required.

* subversion/libsvn_repos/dump_editor.c

(normalize_props): Adjust call to svn_repos__normalize_prop(), explicitly

duplicate the property value into the result pool.

* subversion/svnrdump/load_editor.c

(set_revision_property, set_node_property): Explicitly duplicate the property

values into the long-living pool.

* subversion/svnrdump/util.c

(svn_rdump__normalize_props): Adjust call to svn_repos__normalize_prop(),

explicitly duplicate the property value into the result pool.

  1. … 3 more files in changeset.
Remove redundant code.

* subversion/svnrdump/load_editor.c

(close_revision): Don't validate rev-props again; set_node_property() did it.

Let 'svnrdump' read/write a file instead of stdin/stdout.

svnadmin dump/load already has this option. svnrdump already had some

plumbing for it.

* subversion/libsvn_repos/dump_editor.c

(close_file): Avoid closing the output stream at this point.

* subversion/svnrdump/svnrdump.c

(svnrdump__cmd_table,

svnrdump__options): Enable and document the '--file'/'-F' option.

(replay_revisions,

load_revisions): Close the output stream, when finished.

* subversion/tests/cmdline/svnrdump_tests.py

(run_and_verify_svnrdump_dump,

run_and_verify_svnrdump_load): When a dumpfile is specified, pass it to

svnrdump's '--file' option instead of using stdin/stdout.

(dont_drop_valid_mergeinfo_during_incremental_svnrdump_loads): Remove an

unused return value variable.

  1. … 2 more files in changeset.
Source code re-organization.

* subversion/svnrdump/load_editor.c

(commit_baton_t,

commit_callback,

lock_retry_func,

fetch_base_func,

fetch_props,

fetch_props_func,

fetch_kind_func,

get_shim_callbacks,

get_lock): Move down, to reflect logical organization.

Refactoring svnrdump's load-editor: interpose a filtering layer.

This filtering layer is currently just a framework: it does nothing

functional. Some rdump-specific functionality will later be moved from

the dumpstream-to-editor layer (get_dumpstream_loader) to here.

For issue SVN-4780: Factor out the dumpstream loader editor driver.

* subversion/svnrdump/load_editor.c

(filter_*_t,

filter_*,

get_dumpstream_filter): New.

(svn_rdump__load_dumpstream): Insert this filtering layer.

Tweak for readability.

For issue SVN-4780: Factor out the dumpstream loader editor driver.

* subversion/svnrdump/load_editor.c

(set_revision_property,

close_revision): Say what we mean directly.

Refactor svnrdump's load-editor towards being reusable.

For issue SVN-4780: Factor out the dumpstream loader editor driver.

* subversion/svnrdump/load_editor.c

(new_revision_record): Move further down the file to match its placement

in the vtable and in the dumpstream processing order.

Refactor svnrdump's load-editor towards being reusable.

For issue SVN-4780: Factor out the dumpstream loader editor driver.

* subversion/svnrdump/load_editor.c

(parse_baton): Move commit editor variables from here...

(revision_baton): ... to here. Add 'head_rev_before_commit' here...

(new_revision_record): ... and initialize it here...

(revision_start_edit,

new_node_record): ... instead of recalculating it here.

(set_fulltext,

apply_textdelta,

close_node,

close_revision): Update uses of the moved variables.

Refactor svnrdump's load-editor towards being reusable.

For issue SVN-4780: Factor out the dumpstream loader editor driver.

This pulls out the 'get a commit editor' and 'get props' functions into

callbacks.

* subversion/svnrdump/load_editor.c

(loader_fns_t,

commit_baton_t): New.

(parse_baton): Add callbacks.

(commit_callback,

fetch_base_func,

fetch_props_func,

fetch_kind_func,

get_shim_callbacks): Take a commit_baton_t instead of a revision_baton.

(fetch_props): New: a callback, split out from fetch_props_func().

(revision_start_edit): New.

(new_node_record,

close_revision): Get a commit editor via callback instead of directly.

(remove_node_props): Get props via callback instead of directly.

(revstart): New: a callback.

(get_dumpstream_loader): Initialize the callbacks.

Factor out the dump-stream header writing functions.

Although these are small functions, consistency is nice.

* subversion/include/private/svn_repos_private.h,

subversion/libsvn_repos/dump.c

(svn_repos__dump_magic_header_record,

svn_repos__dump_uuid_header_record): New.

(svn_repos_dump_fs4): Use them.

* subversion/svndumpfilter/svndumpfilter.c

(magic_header_record,

uuid_record): Use them.

* subversion/svnrdump/svnrdump.c

(replay_revisions): Use them.

  1. … 3 more files in changeset.
* subversion/svnrdump/load_editor.c

(commit_callback): Add a doc string.

Introduce a small separation of concerns in svnrdump's dumpstream loader.

* subversion/svnrdump/svnrdump.h,

subversion/svnrdump/load_editor.c

(get_dumpstream_loader): New, separated out...

(svn_rdump__load_dumpstream): ... from here. Improve doc string.

  1. … 2 more files in changeset.
* subversion/svnrdump/load_editor.c

(svn_rdump__load_dumpstream): Remove redundant code.

Move the 'svnrdump' dump editor implementation to libsvn_repos.

This brings it alongside the dump editor implementation used by 'svnadmin

dump', as a step towards unifying the two implementations.

* subversion/include/private/svn_repos_private.h

(svn_repos__get_dump_editor): New declaration.

* subversion/libsvn_repos/dump_editor.c

New file, copied from subversion/svnrdump/dump_editor.c.

Move the dump editor to here...

* subversion/svnrdump/dump_editor.c

... from here, leaving behind just the two wrappers (cancellation and Ev2

shims).

  1. … 2 more files in changeset.
Update issue tracker links in comments, from Tigris (issuezilla) to Apache (Jira).

URL fragment identifiers like '#desc5' are left in place, not yet updated.

This is a merge of r1828508 from the 'shelve-checkpoint' branch where I

committed it by mistake.

  1. … 42 more files in changeset.
Deprecate the previous version of the command-line help text API, following

r1826328.

* subversion/include/svn_opt.h

Deprecate.

* subversion/libsvn_subr/opt.c

Move deprecated functions and their helpers (and copy one of them)...

* subversion/libsvn_subr/deprecated.c

... to here.

* subversion/svnmucc/svnmucc.c,

subversion/svnrdump/svnrdump.c,

subversion/svnserve/svnserve.c,

subversion/svnversion/svnversion.c,

tools/dev/svnmover/svnmover.c,

tools/dev/svnraisetreeconflict/svnraisetreeconflict.c,

tools/dev/wc-ng/svn-wc-db-tester.c

Bump remaining calls to svn_opt_print_help4() to svn_opt_print_help5().

  1. … 9 more files in changeset.
Split long help strings into paragraphs to ease translation.

Resolves issue SVN-4724.

This patch covers every help string defined in svn_opt_subcommand_desc3_t

format, which is most help strings in most but not all of the command-line

programs 'svn', 'svnadmin', etc. For this patch, the definition of a

paragraph is a group of non-blank lines. The split points can be manually

adjusted later.

* subversion/svnadmin/svnadmin.c,

subversion/svnbench/svnbench.c,

subversion/svnfsfs/svnfsfs.c,

subversion/svnlook/svnlook.c,

subversion/svnrdump/svnrdump.c,

subversion/svn/svn.c,

subversion/svnsync/svnsync.c,

tools/client-side/svnconflict/svnconflict.c,

tools/client-side/svn-mergeinfo-normalizer/svn-mergeinfo-normalizer.c

Split long help texts.

  1. … 8 more files in changeset.
In help strings, use a separate source line for each blank line, for

consistency.

  1. … 4 more files in changeset.
Allow splitting long help strings into paragraphs to ease translation.

Issue SVN-4724.

This patch revises the help string definition format that is used in 'svn'

and most of the other command-line tools to svn_opt_subcommand_desc3_t

(introduced in r1826328).

This patch does not split each long string into paragrpahs, it only adds the

mechanism for doing so.

  1. … 16 more files in changeset.
Rename and move the new-for-1.10 function 'svn_io_stdin_readline()' to

'svn_cmdline__stdin_readline()'.

It is just a wrapper around existing API functions and lacks some checking and

options so was deemed not suitable to go into the public API in its current

form.

* subversion/include/private/svn_cmdline_private.h,

subversion/libsvn_subr/cmdline.c

(svn_cmdline__stdin_readline): Rename and move to here...

* subversion/include/svn_io.h

* subversion/libsvn_subr/io.c

(svn_io_stdin_readline): ... from here.

* subversion/svnbench/svnbench.c,

subversion/svnmucc/svnmucc.c,

subversion/svnrdump/svnrdump.c,

subversion/svn/svn.c,

tools/client-side/svnconflict/svnconflict.c,

tools/client-side/svn-mergeinfo-normalizer/svn-mergeinfo-normalizer.c,

tools/dev/svnmover/svnmover.c

(sub_main): Track the rename.

  1. … 10 more files in changeset.
Introduce a new global option: --password-from-stdin

This new option makes Subversion's command line applications read a password

from standard input. It can be used as an alternative to the --password option

in order to provide passwords without leaking them to argv, which on Unix-like

systems can be viewed by anyone with tools such as ps(1).

Patch by: William Orr <will@worrbase.com>

* subversion/include/svn_io.h

(svn_io_stdin_readline): Declare.

* subversion/libsvn_subr/io.c

(svn_io_stdin_readline): New public API which reads a line of input from

standard input.

* subversion/svn/cl.h

(svn_cl__opt_state_t): Declare auth_password_from_stdin option.

* subversion/svn/svn.c,

subversion/svnbench/svnbench.c

(svn_cl__longopt_t): Add opt_auth_password_from_stdin.

(svn_cl__options): Add --password-from-stdin.

(svn_cl__global_options): Add opt_auth_password_from_stdin.

(sub_main): Handle the new option.

* subversion/svnmucc/svnmucc.c

(help): Add --password-from-stdin option to help text.

(sub_main): Handle the new option.

* subversion/svnrdump/svnrdump.c

(svn_svnrdump__longopt_t): Add opt_auth_password_from_stdin.

(svnrdump__options, opt_baton_t): Add --password-from-stdin and --dumpfile.

(opt_baton_t, replay_revisions, dump_cmp, load_cmd, sub_main): Add support

for the new options. Since svnrdump has historically been reading dump file

data from stdin the --password-from-stdin option requires --dumpfile.

* subversion/tests/cmdline/getopt_tests_data/svn_help_log_switch_stdout:

Adjust exected output.

* tools/client-side/svn-mergeinfo-normalizer/svn-mergeinfo-normalizer.c

(svn_min__longopt_t, svn_min__options): Add opt_auth_password_from_stdin.

(svn_min__options): Add --password-from-stdin.

(sub_main): Support the new options.

* tools/client-side/svnconflict/svnconflict.c

(svnconflict_cmd_baton_t, global_options): Add opt_auth_password_from_stdin.

(svnconflict_options): Add --password-from-stdin.

(sub_main): Support the new options.

  1. … 10 more files in changeset.
svnadmin: Introduce the `--normalize-props` option for the load and

load-revprops commands.

Currently, the only performed normalization is the automatic translation

of non-LF line endings in the svn: property values. Apparently, this is

a common issue reported by our users, as Subversion versions prior to 1.6

allowed such values for properties like svn:log and so they can be present

in the dump files. The behavior before this changeset is that a user can

either force loading the dump with such invalid properties using the

--bypass-prop-validation (that affects reading them in the future),

manually repair the dump file or use a tool like svnsync that performs

the property normalization. It would be better if the users had an option

to fix this right in the svnadmin load command.

See also the corresponding FAQ entry and related issues that have been

fixed in svnsync and svnrdump:

https://subversion.apache.org/faq.html#fix-nonLF-log

https://issues.apache.org/jira/browse/SVN-3404

https://issues.apache.org/jira/browse/SVN-4263

* subversion/include/svn_repos.h

(svn_repos_load_fs6): New version of svn_repos_load_fs5() accepting the

new `normalize_props` argument.

(svn_repos_load_fs5): Deprecate.

(svn_repos_load_fs_revprops): Accept the new `normalize_props` argument.

(svn_repos_get_fs_build_parser6): New version of

svn_repos_get_fs_build_parser5() accepting the new `normalize_props`

argument.

* subversion/include/private/svn_repos_private.h

(svn_repos__normalize_prop): New private helper. The `normalized_p`

argument will be currently unused by all calling sites, but it's added

as the groundwork to simplify implementing the notifications about

normalized properties in the future.

* subversion/libsvn_repos/deprecated.c

(svn_repos_load_fs5, svn_repos_get_fs_build_parser5): Implement by

forwarding to the new versions of these functions.

* subversion/libsvn_repos/fs-wrap.c

(): Include svn_subst.h.

(svn_repos__normalize_prop): Implement this new helper function.

The implementation is close to how svn_rdump__normalize_prop() is

written, but this function accepts two pools and handles the new

`normalized_p` output argument.

* subversion/libsvn_repos/load-fs-vtable.c

(struct parse_baton): Add new `normalize_props` field.

(change_rev_prop): Accept new `normalize_props` argument, call the

new helper function if it's set.

(close_revision): Normalize the revision properties if necessary.

(svn_repos_get_fs_build_parser6): New, replacing ...

(svn_repos_get_fs_build_parser5): ...this function.

(svn_repos_load_fs6): New, replacing ...

(svn_repos_load_fs5): ...this function.

(revprops_close_revision): Update call to change_rev_prop().

(build_revprop_parser): Accept new `normalize_props` argument, use it

to initialize the new field in the parse_baton.

(svn_repos_load_fs_revprops): Handle the new `normalize_props` argument

by forwarding it to build_revprop_parser().

* subversion/svnadmin/svnadmin.c

(svnadmin__cmdline_options_t, options_table): Add svnadmin__normalize_props.

(cmd_table): Enable the new option for load and load-revprops commands.

(struct svnadmin_opt_state): Add new `normalize_props` field and ...

(sub_main): ...initialize it here.

(subcommand_load, subcommand_load_revprops): Normalize properties when

running with --normalize-props. Use separate hints when encountering

invalid properties with non-LF line endings and all other kinds of

invalid properties.

* subversion/svnrdump/svnrdump.h

(svn_rdump__normalize_prop): Remove this declaration. This function is

now superseded by the new svn_repos__normalize_prop() helper.

* subversion/svnrdump/util.c

(): Include svn_repos_private.h, drop other includes.

(svn_rdump__normalize_prop): Remove. This function is now superseded

by the new svn_repos__normalize_prop() helper.

(svn_rdump__normalize_props): Use the new svn_repos__normalize_prop()

helper function.

* subversion/svnrdump/load_editor.c

(set_revision_property, set_node_property): Use the new

svn_repos__normalize_prop() helper function.

* subversion/tests/libsvn_repos/dump-load-test.c

(test_load_bad_props): Use the new svn_repos_load_fs6() function, keep

the previous behavior unchanged, i.e., do not normalize the properties.

* subversion/tests/cmdline/svntest/actions.py

(run_and_verify_load, load_repo): Accept new `normalize_props` argument.

* subversion/tests/cmdline/svnadmin_tests.py

(load_bad_props): Test loading with --normalize-props. Check for the error

codes reported during load with non-LF line endings and without the new

option. In cases when the load is successful, check the resulting

svn:log property value in the repository.

* tools/client-side/bash-completion

(_svnadmin): Extend completion info.

  1. … 10 more files in changeset.
Avoid a function with a potentially unexpected side effect by introducing

an output parameter instead of changing the value in place.

* subversion/svnrdump/svnrdump.h

(svn_rdump__normalize_prop): Add output parameter and update the docstring.

(svn_rdump__normalize_props): Update the docstring.

* subversion/svnrdump/util.c

(svn_rdump__normalize_prop): Populate the output parameter. Ensure

that the resulting value is always copied (even if unchanged) to the

result pool; that should also allow to sometimes get rid of the double

copying on the calling site.

(svn_rdump__normalize_props): Update call to svn_rdump__normalize_prop().

* subversion/svnrdump/load_editor.c

(set_revision_property, set_node_property): Update these calling sites of

svn_rdump__normalize_prop(). Don't make unnecessary copies, as

now the values are always copied to the result pool during the call

to svn_rdump__normalize_prop().

Use more robust coding style in handling UTF-8 conversion of command-line

arguments.

Convert to UTF-8 as soon as possible, and name variables assuming UTF-8

encoding is the default rather than an exception, and minimize visibility of

non-UTF-8 values.

* subversion/svn/propdel-cmd.c,

subversion/svn/propedit-cmd.c,

subversion/svn/propget-cmd.c,

subversion/svn/propset-cmd.c:

Rename variables assuming UTF-8; minimize storing non-UTF-8 values.

* subversion/svn/svn.c,

subversion/svnadmin/svnadmin.c,

subversion/svnbench/svnbench.c,

subversion/svndumpfilter/svndumpfilter.c,

subversion/svnfsfs/svnfsfs.c,

subversion/svnlook/svnlook.c,

subversion/svnmucc/svnmucc.c,

subversion/svnrdump/svnrdump.c,

subversion/svnsync/svnsync.c

tools/client-side/svnconflict/svnconflict.c

tools/client-side/svn-mergeinfo-normalizer/svn-mergeinfo-normalizer.c

tools/dev/svnmover/svnmover.c

tools/server-side/svnauthz.c

(sub_main): Convert to UTF-8 before matching the subcommand name; no

observable change if environment's encoding is a superset of ASCII.

(...): Rename variables assuming UTF-8; minimize storing non-UTF-8 values.

  1. … 16 more files in changeset.
* subversion/svn/svn.c

* subversion/svnadmin/svnadmin.c

* subversion/svnbench/svnbench.c

* subversion/svnfsfs/svnfsfs.c

* subversion/svnlook/svnlook.c

* subversion/svnrdump/svnrdump.c

* subversion/svnsync/svnsync.c

(): Remove another unsed header file.

  1. … 6 more files in changeset.
* subversion/svn/svn.c

* subversion/svnadmin/svnadmin.c

* subversion/svnfsfs/svnfsfs.c

* subversion/svnlook/svnlook.c

* subversion/svnrdump/svnrdump.c

* subversion/svnsync/svnsync.c

(): Remove now unsed header files.

  1. … 5 more files in changeset.
Move a bit more of the signal handling code from the programs to the library.

* subversion/include/private/svn_cmdline_private.h

(svn_cmdline__get_cancellation_signal): Remove.

(svn_cmdline__cancellation_exit): New.

* subversion/libsvn_subr/cmdline.c

(svn_cmdline__get_cancellation_signal): Remove.

(svn_cmdline__cancellation_exit): New.

* subversion/svn/svn.c

* subversion/svnadmin/svnadmin.c

* subversion/svnbench/svnbench.c

* subversion/svnfsfs/svnfsfs.c

* subversion/svnlook/svnlook.c

* subversion/svnrdump/svnrdump.c

* subversion/svnsync/svnsync.c

(main): Call new function.

  1. … 8 more files in changeset.
Move signal handling and cancellation code to libsvn_subr to avoid

duplication in multiple programs.

* subversion/include/private/svn_cmdline_private.h

(svn_cmdline__setup_cancellation_handler,

svn_cmdline__disable_cancellation_handler,

svn_cmdline__get_cancellation_signal): New.

* subversion/libsvn_subr/cmdline.c

(signal_handler, check_cancel,

svn_cmdline__setup_cancellation_handler,

svn_cmdline__disable_cancellation_handler,

svn_cmdline__get_cancellation_signal): New, code from svn.c and svnadmin.c.

* subversion/svn/cl.h

(svn_cl__check_cancel): Change type to pointer.

* subversion/svn/svn.c

(svn_cl__check_cancel): Change type to pointer.

(signal_handler): Remove.

(sub_main, main): Call new functions.

* subversion/svnadmin/svnadmin.c

(check_cancel): Change type to pointer.

(signal_handler, setup_cancellation_signalsl): Remove.

(repos_notify_handler, subcommand_recover, subcommand_upgrade,

sub_main, main): Call new functions.

* subversion/svnbench/cl.h

(svn_cl__check_cancel): Change type to pointer.

* subversion/svnbench/svnbench.c

(svn_cl__check_cancel): Change type to pointer.

(signal_handler): Remove.

(sub_main, main): Call new functions.

* subversion/svnfsfs/svnfsfs.h

(check_cancel): Change type to pointer.

* subversion/svnfsfs/svnfsfs.c

(check_cancel): Change type to pointer.

(signal_handler, setup_cancellation_signals): Remove.

(sub_main, main): Call new functions.

* subversion/svnlook/svnlook.c

(check_cancel): Change type to pointer.

(signal_handler): Remove.

(sub_main, main): Call new functions.

* subversion/svnrdump/svnrdump.c

(check_cancel): Change type to pointer.

(signal_handler): Remove.

(sub_main, main): Call new functions.

* subversion/svnsync/svnsync.c

(check_cancel): Change type to pointer.

(signal_handler): Remove.

(sub_main, main): Call new functions.

  1. … 11 more files in changeset.
* subversion/svn/svn.c

* subversion/svnadmin/svnadmin.c

* subversion/svnbench/svnbench.c

* subversion/svnfsfs/svnfsfs.c

* subversion/svnlook/svnlook.c

* subversion/svnrdump/svnrdump.c

* subversion/svnsync/svnsync.c

(signal_map): Fix typo in WIN32 code.

  1. … 6 more files in changeset.
* subversion/svn/svn.c

* subversion/svnbench/svnbench.c

* subversion/svnfsfs/svnfsfs.c

* subversion/svnlook/svnlook.c

* subversion/svnrdump/svnrdump.c

* subversion/svnsync/svnsync.c

(signal_handler, setup_cancellation,

sub_main, main): Followup to r1727916, handle race if second signal

arrives, don't assume int fits in sig_atomic_t.

Found by: danielsh

  1. … 6 more files in changeset.