Some of our FSFS config settings will cause malfunction if invalid
values were given.  Thus, sanitize them before using them.

* subversion/libsvn_fs_fs/fs_fs.c
  (sanitize_block_size): New function to verify config data.
  (read_config): Use the new function to guarantee valid settings
                 in our FS struct.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1628392 13f79535-47bb-0310-9956-ffa450edef68
Fix / silence some integer conversion warnings.

* subversion/libsvn_fs_fs/index.c
  (packed_stream_read): We know those are well within apr_size_t's
                        value range.
  (auto_open_l2p_index): The config reader limits the BLOCK_SIZE
                         to apr_size_t since r1628392.
  (get_l2p_header_body): Use the appropriate type for the iteration
                         variable.  Use maximally widening casts
                         for non-negative values where appropriate.
                         Cast revnum count after we verified its range
                         to be within MAX_FILES_PER_DIR.
  (prefetch_l2p_pages): Exit early for non-positive ranges and use
                        maximally widening casts for non-negative
                        values where appropriate.

git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1628393 13f79535-47bb-0310-9956-ffa450edef68
Make 'svn checkout' report externals failures via its exit code,
like the export, list, switch, and update subcommands already do.

* subversion/svn/checkout-cmd.c
  (svn_cl__checkout): Make use of svn_cl__check_externals_failed_notify_wrapper.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1628398 13f79535-47bb-0310-9956-ffa450edef68
Fix / silence a few more conversion warnings.

* subversion/libsvn_fs_fs/index.c
  (svn_fs_fs__l2p_index_append,
   auto_open_p2l_index): Safe shortening cast.
  (get_p2l_header): Use alternative variable with the same contents.
                    Use maximally widening cast where appropriate.
  (p2l_page_info_copy): Safe shortening cast.

git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1628415 13f79535-47bb-0310-9956-ffa450edef68
Don't use the platform-specific APR_*_FMT macros in translatable strings.

* subversion/libsvn_fs_fs/index.c
  (read_uint32_from_proto_index,
   read_off_t_from_proto_index, 
   read_p2l_entry_from_proto_index): Convert numbers to strings before
                                     using them in a translatable format
                                     string.

* subversion/libsvn_fs_fs/fs_fs.c
  (verify_block_size): Same.
  (read_config): Update caller.

Found by: brane


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1628427 13f79535-47bb-0310-9956-ffa450edef68
Extend XFail test for issue #4085, "external can shadow a versioned directory"

* subversion/tests/cmdline/externals_tests.py
  (shadowing): Try to remove the shadowed directory and update the working copy.
   This shows that the working copy remains wedged even if the user attempts
   to recover from the situation by removing the offending directory.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1628431 13f79535-47bb-0310-9956-ffa450edef68
Fix issue #4085, "external can shadow a versioned directory".

* subversion/libsvn_client/externals.c
  (switch_dir_external): Don't try to switch BASE nodes over to an external.
   The switch will succeed, but the subsequent attempt of registering the
   external will fail with an error. The working copy is then left in a bad
   state until the path is switched back. With this fix we fail much earlier,
   before switching the path, allowing users to recover cleanly by removing
   either the external definition or the directory shadowed by the external.

* subversion/tests/cmdline/externals_tests.py
  (shadowing): Remove XFail marker.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1628536 13f79535-47bb-0310-9956-ffa450edef68
* subversion/tests/cmdline/externals_tests.py
  (shadowing): Adjust comments now that the test passes since r1628536.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1628540 13f79535-47bb-0310-9956-ffa450edef68
Tweak comments.

* subversion/libsvn_fs_fs/transaction.c,
  subversion/libsvn_fs_x/transaction.c
  (replace_change): Remove a comment, wrongly duplicated in r1525419.
  (fold_change): Revert a comment, missed in reverting r1525419 in r1597989.

git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1628676 13f79535-47bb-0310-9956-ffa450edef68
Add comments.

* subversion/libsvn_repos/rev_hunt.c
  (path_revision,
   get_merged_mergeinfo): Explain what the mergeinfo 'difference' really is.

git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1628685 13f79535-47bb-0310-9956-ffa450edef68
Remove obsolete code from FSFS hotcopy.
There are no separate index files anymore.

* subversion/libsvn_fs_fs/hotcopy.c
  (hotcopy_remove_files): Drop REMOVE_INDEXES parameter and don't try
                          to delete those n/a files anymore.
  (hotcopy_remove_rev_files,
   hotcopy_remove_revprop_files): Update caller.

git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1628738 13f79535-47bb-0310-9956-ffa450edef68
* subversion/include/svn_fs.h
  (svn_fs_path_change2_t): Extend docstrings to explain when the
                           *_mod fields will assume which values.
                           No functional change.

Patch by: julianfoad


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1628759 13f79535-47bb-0310-9956-ffa450edef68
* subversion/libsvn_fs_fs/low_level.c
  (read_change): Fix reporting of the "mergeinfo_mod" flag for changed
                 paths if the flag insn't actually stored in the repo.
                 We must explicitly initialize it to svn_tristate_unknown.

Found by: julianfoad


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1628762 13f79535-47bb-0310-9956-ffa450edef68
* subversion/libsvn_fs_fs/tree.c
  (fs_change_node_prop): Fix typo in variable name.

Found by: julianfoad


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1628764 13f79535-47bb-0310-9956-ffa450edef68
Fix issue #4513: 'svn auth' shouldn't treat argv patterns as URLs.

* subversion/svn/auth-cmd.c
  (svn_cl__auth): Convert arguments to UTF-8 but otherwise leave them
   unchanged. Prevents patterns from being mangled by URL canonicalisation.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1629616 13f79535-47bb-0310-9956-ffa450edef68
In FSFS, always use the same function to read the 'current' file.

Apart from the consistency aspect, this no longer lets atoi() mask
'current' file corruptions.  Recovery must be adopted to this.

* subversion/libsvn_fs_fs/fs_fs.c
  (get_youngest): Change signature because we will need the format
                  info as well - not just a repo path.  Call the util
                  function to read and interpret the 'current' file.
  (with_some_lock_file,
   svn_fs_fs__open,
   svn_fs_fs__youngest_rev,
   svn_fs_fs__ensure_revision_exists): Update callers.

* subversion/libsvn_fs_fs/fs.c
  (fs_open_for_recovery): Make sure, a valid 'current' file is available
                          for repository recovery.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1629854 13f79535-47bb-0310-9956-ffa450edef68
Use the same function to initialize the FSFS 'current' file that we
use to update it.

* subversion/libsvn_fs_fs/fs_fs.c
  (svn_fs_fs__create): Manually create the file and then use the util
                       function to write its content.

git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1629855 13f79535-47bb-0310-9956-ffa450edef68
Make the FSFS hotcopy-internal function hotcopy_remove_file() slightly
more generic.  This is a mere preparation for a following commit.

* subversion/libsvn_fs_fs/hotcopy.c
  (hotcopy_remove_file): Instead shard path + local file name, take the
                         full file path as parameter.
  (hotcopy_remove_files): Update caller.

git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1629857 13f79535-47bb-0310-9956-ffa450edef68
Eliminate duplicate repository creation code from FSFS hotcopy.

Factor out most of svn_fs_fs__create into a svn_fs_fs__create_file_tree
function that creates all of the required files and sub-folders.  Use it
in hotcopy to create the empty target repository.

* subversion/libsvn_fs_fs/fs_fs.h
  (svn_fs_fs__create_file_tree): Declare new private API function.

* subversion/libsvn_fs_fs/fs_fs.c
  (svn_fs_fs__create_file_tree): Implement it with code taken from ...
  (svn_fs_fs__create): ... this.  Keep only the parameter checking and
                       the final 'format' file creation.

* subversion/libsvn_fs_fs/hotcopy.c
  (hotcopy_create_empty_dest): Use the new private API to create the
                               target repo and tweak it to our needs.


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1629865 13f79535-47bb-0310-9956-ffa450edef68
* subversion/libsvn_fs_fs/fs_fs.c
  (read_global_config): Don't segafault if fs_open is not provided with
                        a config hash.

git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1629873 13f79535-47bb-0310-9956-ffa450edef68