Return-Path: Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: (qmail 28371 invoked from network); 1 Jun 2010 13:14:59 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 Jun 2010 13:14:59 -0000 Received: (qmail 13113 invoked by uid 500); 1 Jun 2010 13:14:59 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 13073 invoked by uid 500); 1 Jun 2010 13:14:59 -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 13066 invoked by uid 99); 1 Jun 2010 13:14:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Jun 2010 13:14:58 +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, 01 Jun 2010 13:14:55 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 82F9C23889E5; Tue, 1 Jun 2010 13:14:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r950065 - in /subversion/trunk/subversion/libsvn_wc: adm_ops.c entries.c entries.h Date: Tue, 01 Jun 2010 13:14:30 -0000 To: commits@subversion.apache.org From: rhuijben@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100601131430.82F9C23889E5@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rhuijben Date: Tue Jun 1 13:14:30 2010 New Revision: 950065 URL: http://svn.apache.org/viewvc?rev=950065&view=rev Log: Reduce the scope of an entry based helper of svn_wc__do_update_cleanup(). * subversion/libsvn_wc/adm_ops.c (tweak_node): Moved function here, renamed. * subversion/libsvn_wc/entries.c (svn_wc__tweak_entry): Remove function here. * subversion/libsvn_wc/entries.h (svn_wc__tweak_entry): Remove function here. Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c subversion/trunk/subversion/libsvn_wc/entries.c subversion/trunk/subversion/libsvn_wc/entries.h Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=950065&r1=950064&r2=950065&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original) +++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Tue Jun 1 13:14:30 2010 @@ -102,6 +102,88 @@ svn_wc__get_committed_queue_pool(const s /*** Finishing updates and commits. ***/ +/* Helper for svn_wc__do_update_cleanup(). + * + * Tweak the information for LOCAL_ABSPATH in DB. If NEW_URL is non-null, + * make this the entry's new url. If NEW_REV is valid, make this the + * entry's working revision. + * + * If ALLOW_REMOVAL is TRUE the tweaks might cause the entry for + * LOCAL_ABSPATH to be removed from the WC; if ALLOW_REMOVAL is FALSE this + * will not happen. + * + * THIS_DIR should be true if the LOCAL_ABSPATH refers to a directory, and + * the information to be edited is not in the stub entry. + */ +static svn_error_t * +tweak_node(svn_wc__db_t *db, + const char *local_abspath, + svn_node_kind_t kind, + svn_boolean_t parent_stub, + const char *new_url, + svn_revnum_t new_rev, + svn_boolean_t allow_removal, + apr_pool_t *scratch_pool) +{ +const svn_wc_entry_t *entry; + svn_wc_entry_t tmp_entry; + int modify_flags = 0; + + SVN_ERR(svn_wc__get_entry(&entry, db, local_abspath, FALSE, kind, + parent_stub, scratch_pool, scratch_pool)); + + if (new_url != NULL + && (! entry->url || strcmp(new_url, entry->url))) + { + modify_flags |= SVN_WC__ENTRY_MODIFY_URL; + tmp_entry.url = new_url; + } + + if ((SVN_IS_VALID_REVNUM(new_rev)) + && (entry->schedule != svn_wc_schedule_add) + && (entry->schedule != svn_wc_schedule_replace) + && (entry->copied != TRUE) + && (entry->revision != new_rev)) + { + modify_flags |= SVN_WC__ENTRY_MODIFY_REVISION; + tmp_entry.revision = new_rev; + } + + /* As long as this function is only called as a helper to + svn_wc__do_update_cleanup, then it's okay to remove any entry + under certain circumstances: + + If the entry is still marked 'deleted', then the server did not + re-add it. So it's really gone in this revision, thus we remove + the entry. + + If the entry is still marked 'absent' and yet is not the same + revision as new_rev, then the server did not re-add it, nor + re-absent it, so we can remove the entry. + + ### This function cannot always determine whether removal is + ### appropriate, hence the ALLOW_REMOVAL flag. It's all a bit of a + ### mess. */ + if (allow_removal + && (entry->deleted || (entry->absent && entry->revision != new_rev))) + { + SVN_ERR(svn_wc__db_temp_op_remove_entry(db, local_abspath, + scratch_pool)); + } + else if (modify_flags) + { + if (entry->kind == svn_node_dir && parent_stub) + SVN_ERR(svn_wc__entry_modify_stub(db, local_abspath, + &tmp_entry, modify_flags, + scratch_pool)); + else + SVN_ERR(svn_wc__entry_modify(db, local_abspath, entry->kind, + &tmp_entry, modify_flags, scratch_pool)); + } + + return SVN_NO_ERROR; +} + /* The main body of svn_wc__do_update_cleanup. */ static svn_error_t * @@ -127,9 +209,8 @@ tweak_entries(svn_wc__db_t *db, iterpool = svn_pool_create(pool); /* Tweak "this_dir" */ - SVN_ERR(svn_wc__tweak_entry(db, dir_abspath, svn_node_dir, FALSE, - base_url, new_rev, - FALSE /* allow_removal */, iterpool)); + SVN_ERR(tweak_node(db, dir_abspath, svn_node_dir, FALSE, base_url, new_rev, + FALSE /* allow_removal */, iterpool)); if (depth == svn_depth_unknown) depth = svn_depth_infinity; @@ -180,15 +261,13 @@ tweak_entries(svn_wc__db_t *db, continue; if (kind == svn_wc__db_kind_dir) - SVN_ERR(svn_wc__tweak_entry(db, child_abspath, svn_node_dir, TRUE, - child_url, new_rev, - TRUE /* allow_removal */, - iterpool)); + SVN_ERR(tweak_node(db, child_abspath, svn_node_dir, TRUE, + child_url, new_rev, TRUE /* allow_removal */, + iterpool)); else - SVN_ERR(svn_wc__tweak_entry(db, child_abspath, svn_node_file, FALSE, - child_url, new_rev, - TRUE /* allow_removal */, - iterpool)); + SVN_ERR(tweak_node(db, child_abspath, svn_node_file, FALSE, + child_url, new_rev, TRUE /* allow_removal */, + iterpool)); } /* If a directory and recursive... */ @@ -294,10 +373,8 @@ svn_wc__do_update_cleanup(svn_wc__db_t * case svn_wc__db_status_obstructed_delete: /* There is only a parent stub. That's fine... just tweak it and avoid directory recursion. */ - SVN_ERR(svn_wc__tweak_entry(db, local_abspath, svn_node_dir, TRUE, - base_url, new_revision, - FALSE /* allow_removal */, - pool)); + SVN_ERR(tweak_node(db, local_abspath, svn_node_dir, TRUE, base_url, + new_revision, FALSE /* allow_removal */, pool)); return SVN_NO_ERROR; /* Explicitly ignore other statii */ @@ -308,10 +385,8 @@ svn_wc__do_update_cleanup(svn_wc__db_t * if (kind == svn_wc__db_kind_file || kind == svn_wc__db_kind_symlink) { /* Parent not updated so don't remove PATH entry. */ - SVN_ERR(svn_wc__tweak_entry(db, local_abspath, svn_node_file, FALSE, - base_url, new_revision, - FALSE /* allow_removal */, - pool)); + SVN_ERR(tweak_node(db, local_abspath, svn_node_file, FALSE, base_url, + new_revision, FALSE /* allow_removal */, pool)); } else if (kind == svn_wc__db_kind_dir) { @@ -1290,9 +1365,8 @@ mark_tree_copied(svn_wc__db_t *db, int i; /* Tweak "this_dir" */ - SVN_ERR(svn_wc__tweak_entry(db, dir_abspath, svn_node_dir, FALSE, - base_url, SVN_INVALID_REVNUM, - FALSE /* allow_removal */, iterpool)); + SVN_ERR(tweak_node(db, dir_abspath, svn_node_dir, FALSE, base_url, + SVN_INVALID_REVNUM, FALSE /* allow_removal */, iterpool)); /* Read the entries file for this directory. */ SVN_ERR(svn_wc__db_read_children(&children, db, dir_abspath, @@ -1336,14 +1410,13 @@ mark_tree_copied(svn_wc__db_t *db, || child_status == svn_wc__db_status_excluded) { if (child_kind == svn_wc__db_kind_dir) - SVN_ERR(svn_wc__tweak_entry(db, child_abspath, svn_node_dir, - TRUE /* parent_stub */, - child_url, SVN_INVALID_REVNUM, - TRUE /* allow_removal */, - iterpool)); + SVN_ERR(tweak_node(db, child_abspath, svn_node_dir, + TRUE /* parent_stub */, child_url, + SVN_INVALID_REVNUM, TRUE /* allow_removal */, + iterpool)); else - SVN_ERR(svn_wc__tweak_entry(db, child_abspath, svn_node_file, - FALSE /* parent_stub */, + SVN_ERR(tweak_node(db, child_abspath, svn_node_file, + FALSE /* parent_stub */, child_url, SVN_INVALID_REVNUM, TRUE /* allow_removal */, iterpool)); Modified: subversion/trunk/subversion/libsvn_wc/entries.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/entries.c?rev=950065&r1=950064&r2=950065&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/entries.c (original) +++ subversion/trunk/subversion/libsvn_wc/entries.c Tue Jun 1 13:14:30 2010 @@ -3107,76 +3107,6 @@ svn_wc_entry_dup(const svn_wc_entry_t *e } -svn_error_t * -svn_wc__tweak_entry(svn_wc__db_t *db, - const char *local_abspath, - svn_node_kind_t kind, - svn_boolean_t parent_stub, - const char *new_url, - svn_revnum_t new_rev, - svn_boolean_t allow_removal, - apr_pool_t *scratch_pool) -{ - const svn_wc_entry_t *entry; - svn_wc_entry_t tmp_entry; - int modify_flags = 0; - - SVN_ERR(svn_wc__get_entry(&entry, db, local_abspath, FALSE, kind, - parent_stub, scratch_pool, scratch_pool)); - - if (new_url != NULL - && (! entry->url || strcmp(new_url, entry->url))) - { - modify_flags |= SVN_WC__ENTRY_MODIFY_URL; - tmp_entry.url = new_url; - } - - if ((SVN_IS_VALID_REVNUM(new_rev)) - && (entry->schedule != svn_wc_schedule_add) - && (entry->schedule != svn_wc_schedule_replace) - && (entry->copied != TRUE) - && (entry->revision != new_rev)) - { - modify_flags |= SVN_WC__ENTRY_MODIFY_REVISION; - tmp_entry.revision = new_rev; - } - - /* As long as this function is only called as a helper to - svn_wc__do_update_cleanup, then it's okay to remove any entry - under certain circumstances: - - If the entry is still marked 'deleted', then the server did not - re-add it. So it's really gone in this revision, thus we remove - the entry. - - If the entry is still marked 'absent' and yet is not the same - revision as new_rev, then the server did not re-add it, nor - re-absent it, so we can remove the entry. - - ### This function cannot always determine whether removal is - ### appropriate, hence the ALLOW_REMOVAL flag. It's all a bit of a - ### mess. */ - if (allow_removal - && (entry->deleted || (entry->absent && entry->revision != new_rev))) - { - SVN_ERR(svn_wc__db_temp_op_remove_entry(db, local_abspath, - scratch_pool)); - } - else if (modify_flags) - { - if (entry->kind == svn_node_dir && parent_stub) - SVN_ERR(svn_wc__entry_modify_stub(db, local_abspath, - &tmp_entry, modify_flags, - scratch_pool)); - else - SVN_ERR(svn_wc__entry_modify(db, local_abspath, entry->kind, - &tmp_entry, modify_flags, scratch_pool)); - } - - return SVN_NO_ERROR; -} - - /*** Generic Entry Walker */ /* A recursive entry-walker, helper for svn_wc_walk_entries3(). Modified: subversion/trunk/subversion/libsvn_wc/entries.h URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/entries.h?rev=950065&r1=950064&r2=950065&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/entries.h (original) +++ subversion/trunk/subversion/libsvn_wc/entries.h Tue Jun 1 13:14:30 2010 @@ -126,31 +126,6 @@ svn_wc__entry_modify_stub(svn_wc__db_t * int modify_flags, apr_pool_t *scratch_pool); - -/* Tweak the information for LOCAL_ABSPATH in DB. If NEW_URL is non-null, - * make this the entry's new url. If NEW_REV is valid, make this the - * entry's working revision. - * - * If ALLOW_REMOVAL is TRUE the tweaks might cause the entry for - * LOCAL_ABSPATH to be removed from the WC; if ALLOW_REMOVAL is FALSE this - * will not happen. - * - * THIS_DIR should be true if the LOCAL_ABSPATH refers to a directory, and - * the information to be edited is not in the stub entry. - * - * (Intended as a helper to svn_wc__do_update_cleanup, which see.) - */ -svn_error_t * -svn_wc__tweak_entry(svn_wc__db_t *db, - const char *local_abspath, - svn_node_kind_t kind, - svn_boolean_t parent_stub, - const char *new_url, - svn_revnum_t new_rev, - svn_boolean_t allow_removal, - apr_pool_t *scratch_pool); - - /** Get an ENTRY for the given LOCAL_ABSPATH. * * This API does not require an access baton, just a wc_db handle (DB).