Return-Path: Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: (qmail 97215 invoked from network); 29 Jun 2010 14:33:36 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 29 Jun 2010 14:33:36 -0000 Received: (qmail 38481 invoked by uid 500); 29 Jun 2010 14:33:36 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 38408 invoked by uid 500); 29 Jun 2010 14:33:36 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 38401 invoked by uid 99); 29 Jun 2010 14:33:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Jun 2010 14:33:35 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Jun 2010 14:33:32 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id EB38923888D1; Tue, 29 Jun 2010 14:32:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r958993 - in /subversion/trunk/subversion: libsvn_wc/adm_ops.c libsvn_wc/wc_db.c tests/cmdline/revert_tests.py Date: Tue, 29 Jun 2010 14:32:38 -0000 To: commits@subversion.apache.org From: rhuijben@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100629143238.EB38923888D1@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rhuijben Date: Tue Jun 29 14:32:38 2010 New Revision: 958993 URL: http://svn.apache.org/viewvc?rev=958993&view=rev Log: To improve database consistency, copy the not-present registration from the parent into newly added directories in svn_wc_add4(). This allows retrieving this data via svn_wc__db_read_info(). This fixes revert_tests.py 20. * subversion/libsvn_wc/adm_ops.c (svn_wc_delete4): Fix is-replaced check by allowing not-present base data. (svn_wc_add4): Copy not-present data from the stub to the directory on adding a new wcroot. * subversion/libsvn_wc/wc_db.c (svn_wc__db_base_add_absent_node): Fix adding data in the parent stub, by fixing the stub check and then adding a parent node if needed. * subversion/tests/cmdline/revert_tests.py (revert_add_over_not_present_dir): Update comment (test_list): Remove XFail marking of revert_add_over_not_present_dir. Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c subversion/trunk/subversion/libsvn_wc/wc_db.c subversion/trunk/subversion/tests/cmdline/revert_tests.py Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=958993&r1=958992&r2=958993&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original) +++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Tue Jun 29 14:32:38 2010 @@ -879,7 +879,18 @@ svn_wc_delete4(svn_wc_context_t *wc_ctx, if (!have_base) was_add = strcmp(op_root_abspath, local_abspath) == 0; else - was_replace = TRUE; + { + svn_wc__db_status_t base_status; + SVN_ERR(svn_wc__db_base_get_info(&base_status, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, + db, local_abspath, pool, pool)); + + if (base_status != svn_wc__db_status_not_present) + was_replace = TRUE; + else + was_add = TRUE; + } } /* ### Maybe we should disallow deleting switched nodes here? */ @@ -1327,6 +1338,31 @@ svn_wc_add4(svn_wc_context_t *wc_ctx, #ifndef SINGLE_DB else if (kind == svn_node_dir && !node_exists && !is_replace) { + svn_wc__db_status_t absent_status; + svn_wc__db_kind_t absent_kind; + const char *absent_repos_relpath, *absent_repos_root_url; + const char *absent_repos_uuid; + svn_revnum_t absent_revision; + + /* Read the not present status from the parent working copy, + to reinsert it after hooking up the child working copy */ + + err = svn_wc__db_base_get_info(&absent_status, + &absent_kind, + &absent_revision, + &absent_repos_relpath, + &absent_repos_root_url, + &absent_repos_uuid, + NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + db, local_abspath, + scratch_pool, scratch_pool); + + if (err && err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND) + return svn_error_return(err); + else + svn_error_clear(err); + /* Make sure this new directory has an admistrative subdirectory created inside of it. @@ -1339,7 +1375,19 @@ svn_wc_add4(svn_wc_context_t *wc_ctx, repos_uuid, 0, depth, scratch_pool)); - SVN_ERR(svn_wc__db_base_remove(db, local_abspath, scratch_pool)); + if (!err && absent_status == svn_wc__db_status_not_present) + SVN_ERR(svn_wc__db_base_add_absent_node(db, local_abspath, + absent_repos_relpath, + absent_repos_root_url, + absent_repos_uuid, + absent_revision, + absent_kind, + absent_status, + NULL, + NULL, + scratch_pool)); + else + SVN_ERR(svn_wc__db_base_remove(db, local_abspath, scratch_pool)); } #endif Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=958993&r1=958992&r2=958993&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/wc_db.c (original) +++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Jun 29 14:32:38 2010 @@ -1626,10 +1626,24 @@ svn_wc__db_base_add_absent_node(svn_wc__ flush_entries(pdh); - if (*local_abspath == '\0') + if (*local_relpath == '\0') { - SVN_ERR(navigate_to_parent(&pdh, db, pdh, svn_sqlite__mode_readwrite, - scratch_pool)); + svn_error_t *err; + err = navigate_to_parent(&pdh, db, pdh, svn_sqlite__mode_readwrite, + scratch_pool); + + if (err && err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY) + { + /* Not registered in the parent; we have to add a stub */ + svn_error_clear(err); + + SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db, + svn_dirent_dirname(local_abspath, scratch_pool), + svn_sqlite__mode_readwrite, scratch_pool, + scratch_pool)); + } + else + SVN_ERR(err); VERIFY_USABLE_PDH(pdh); SVN_ERR(create_repos_id(&repos_id, repos_root_url, repos_uuid, Modified: subversion/trunk/subversion/tests/cmdline/revert_tests.py URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/revert_tests.py?rev=958993&r1=958992&r2=958993&view=diff ============================================================================== --- subversion/trunk/subversion/tests/cmdline/revert_tests.py (original) +++ subversion/trunk/subversion/tests/cmdline/revert_tests.py Tue Jun 29 14:32:38 2010 @@ -968,7 +968,7 @@ def revert_add_over_not_present_dir(sbox main.run_svn(None, 'mkdir', os.path.join(wc_dir, 'A/C')) - # This fails in the current WC-NG state (r927318). + # This failed in some WC-NG intermediate format (r927318-r958992). main.run_svn(None, 'revert', os.path.join(wc_dir, 'A/C')) svntest.actions.run_and_verify_status(wc_dir, expected_status) @@ -1000,7 +1000,7 @@ test_list = [ None, status_of_missing_dir_after_revert_replaced_with_history_dir), revert_replaced_with_history_file_2, revert_tree_conflicts_in_updated_files, - XFail(revert_add_over_not_present_dir), + revert_add_over_not_present_dir, ] if __name__ == '__main__':