Index: subversion/libsvn_wc/upgrade.c =================================================================== --- subversion/libsvn_wc/upgrade.c (revision 1604170) +++ subversion/libsvn_wc/upgrade.c (working copy) @@ -430,21 +430,24 @@ /* Wipe out all the obsolete files/dirs from the administrative area. */ static void -wipe_obsolete_files(const char *wcroot_abspath, apr_pool_t *scratch_pool) +wipe_obsolete_files(const char *wcroot_abspath, svn_boolean_t remove_format_entries, apr_pool_t *scratch_pool) { /* Zap unused files. */ + if (remove_format_entries) + { + svn_error_clear(svn_io_remove_file2( + svn_wc__adm_child(wcroot_abspath, + SVN_WC__ADM_FORMAT, + scratch_pool), + TRUE, scratch_pool)); + svn_error_clear(svn_io_remove_file2( + svn_wc__adm_child(wcroot_abspath, + SVN_WC__ADM_ENTRIES, + scratch_pool), + TRUE, scratch_pool)); + } svn_error_clear(svn_io_remove_file2( svn_wc__adm_child(wcroot_abspath, - SVN_WC__ADM_FORMAT, - scratch_pool), - TRUE, scratch_pool)); - svn_error_clear(svn_io_remove_file2( - svn_wc__adm_child(wcroot_abspath, - SVN_WC__ADM_ENTRIES, - scratch_pool), - TRUE, scratch_pool)); - svn_error_clear(svn_io_remove_file2( - svn_wc__adm_child(wcroot_abspath, ADM_EMPTY_FILE, scratch_pool), TRUE, scratch_pool)); @@ -564,7 +567,7 @@ iterpool), TRUE, NULL, NULL, iterpool)); else - wipe_obsolete_files(dir_abspath, scratch_pool); + wipe_obsolete_files(dir_abspath, TRUE, scratch_pool); if (delete_dir) { @@ -1977,7 +1980,7 @@ #endif /* Zap anything that might be remaining or escaped our notice. */ - wipe_obsolete_files(wcroot_abspath, scratch_pool); + wipe_obsolete_files(wcroot_abspath, FALSE, scratch_pool); return SVN_NO_ERROR; } Index: subversion/tests/cmdline/upgrade_tests.py =================================================================== --- subversion/tests/cmdline/upgrade_tests.py (revision 1604170) +++ subversion/tests/cmdline/upgrade_tests.py (working copy) @@ -1438,6 +1438,39 @@ # svn: warning: W200033: sqlite[S5]: database is locked svntest.actions.run_and_verify_svn(None, None, [], 'upgrade', sbox.wc_dir) +@Issue(4395) +def upgrade_dropped_status_entries_files(sbox): + "upgrade dropped entries and status files" + + # We try to test several SVN versions with and without the 1.7.x + # wc db structure. + files_to_test = ( + ('wc-3x-1.4.6.tar.bz2', 'wc-1.4.6'), + ('upgrade_1_5.tar.bz2', None), + ('wc-3x-1.6.12.tar.bz2', 'wc-1.6.12'), + ('upgrade_from_1_7_wc.tar.bz2', None), + ) + + for packedwc, wcdir in files_to_test: + replace_sbox_with_tarfile(sbox, packedwc, dir = wcdir) + + svntest.actions.run_and_verify_svn(None, None, [], 'upgrade', sbox.wc_dir) + + entrypath = os.path.join(sbox.wc_dir, ".svn/entries") + formatpath = os.path.join(sbox.wc_dir, ".svn/entries") + + for filepath in (entrypath, formatpath): + if not os.path.isfile(filepath): + raise svntest.Failure("Upgrade of %s: File %s is missing" % + (packedwc, filepath)) + + if int(open(filepath).read().rstrip()) != 12: + raise svntest.Failure("Upgrade of %s: File %s doesn't denote format 12" % + (packedwc, filepath)) + + + + ######################################################################## # Run the tests @@ -1494,6 +1527,7 @@ iprops_upgrade1_6, changelist_upgrade_1_6, upgrade_1_7_dir_external, + upgrade_dropped_status_entries_files, ]