Remove a db transaction on opening wc.db, and at the same time also verify if the sqlite_stat1 table exists on opening a db from svn_wc__db_wcroot_parse_local_abspath().
If the table exists we try to add the table, but ignore errors to avoid problems when the database is read only (This last part will need verification on other platforms)
* subversion/libsvn_wc/wc-queries.sql (STMT_HAVE_STAT1_TABLE): New statement.
* subversion/libsvn_wc/wc.h (SVN_WC__ENSURE_STAT1_TABLE): New define.
* subversion/libsvn_wc/wc_db_wcroot.c (svn_wc__db_pdh_create_wcroot): Only read format from db when requested by caller, instead of always when we open the db. (verify_stats_table, fetch_db_info): New function. (svn_wc__db_wcroot_parse_local_abspath): Update caller.
Don't lose files that replace file externals, when they are replaced by actual file. The regression test for this issue uncovered the commit fix in r1663991, but the change to db_base_remove() in this revision resolves the problem in a different way.
* subversion/libsvn_wc/externals.c (svn_wc__external_remove): When deleting a file external, request addition of a not-present marker in its place.
* subversion/libsvn_wc/wc-queries.sql (STMT_DELETE_BASE_RECURSIVE): Include node itself.
* subversion/libsvn_wc/wc_db.c (db_base_remove): Detect if a deleted file external really needs to be replaced by a marker. Update caller.
* subversion/tests/cmdline/externals_tests.py (file_external_to_normal_file): New test. (test_list): Add file_external_to_normal_file.
* subversion/tests/libsvn_wc/op-depth-test.c (check_db_rows): Don't use print_row before all values are set in the row struct to avoid segfaults. (revert_file_externals): Expect not_present rows to appear.