You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2010/06/30 00:04:35 UTC
svn commit: r959123 - in /subversion/trunk/subversion/libsvn_wc: adm_ops.c
entries.c entries.h
Author: rhuijben
Date: Tue Jun 29 22:04:34 2010
New Revision: 959123
URL: http://svn.apache.org/viewvc?rev=959123&view=rev
Log:
Remove svn_wc__entry_modify() and svn_wc__entry_modify_stub(). Another
milestone on the way to completing WC-NG.
* subversion/libsvn_wc/adm_ops.c
(svn_wc_add4): Call svn_wc__db_temp_set_parent_stub_to_normal() instead
of using two entry modify calls to prepare for calling
svn_wc__db_temp_op_make_copy().
* subversion/libsvn_wc/entries.c
(fold_entry): Remove function.
(fold_scheduling): Remove function.
(entry_modify): Remove function.
(svn_wc__entry_modify): Remove function.
(svn_wc__entry_modify_stub): Remove function.
* subversion/libsvn_wc/entries.h
(SVN_WC__ENTRY_MODIFY_KIND,
SVN_WC__ENTRY_MODIFY_SCHEDULE,
SVN_WC__ENTRY_MODIFY_COPIED,
SVN_WC__ENTRY_MODIFY_COPYFROM_URL,
SVN_WC__ENTRY_MODIFY_COPYFROM_REV,
SVN_WC__ENTRY_MODIFY_FORCE): Remove unused macros.
(svn_wc__entry_modify,
svn_wc__entry_modify_stub): Remove functions.
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=959123&r1=959122&r2=959123&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Tue Jun 29 22:04:34 2010
@@ -1358,10 +1358,6 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
scratch_pool));
else
{
- svn_wc_entry_t tmp_entry;
- int modify_flags;
- apr_hash_t *props;
-
svn_wc__db_status_t absent_status;
svn_wc__db_kind_t absent_kind;
const char *absent_repos_relpath, *absent_repos_root_url;
@@ -1385,53 +1381,18 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
else
svn_error_clear(err);
- /* Store the pristine properties to install them on working, because
- we might delete the base table */
- SVN_ERR(svn_wc__db_read_pristine_props(&props, db, local_abspath,
- scratch_pool, scratch_pool));
-
- /* Init the modify flags. */
- tmp_entry.schedule = svn_wc_schedule_add;
- tmp_entry.kind = svn_node_dir;
- tmp_entry.copyfrom_url = copyfrom_url;
- tmp_entry.copyfrom_rev = copyfrom_rev;
- tmp_entry.copied = TRUE;
-
- modify_flags = SVN_WC__ENTRY_MODIFY_SCHEDULE
- | SVN_WC__ENTRY_MODIFY_KIND
- | SVN_WC__ENTRY_MODIFY_COPYFROM_URL
- | SVN_WC__ENTRY_MODIFY_COPYFROM_REV
- | SVN_WC__ENTRY_MODIFY_COPIED;
-
- SVN_ERR(svn_wc__entry_modify_stub(db, local_abspath,
- &tmp_entry, modify_flags,
- scratch_pool));
-
- /* We're making the same mods we made above, but this time we'll
- force the scheduling. Also make sure to undo the
- 'incomplete' flag which svn_wc__internal_ensure_adm() sets by
- default.
-
- This deletes the erroneous BASE_NODE for added directories and
- adds a WORKING_NODE. */
- modify_flags |= SVN_WC__ENTRY_MODIFY_FORCE;
- tmp_entry.schedule = (is_replace
- ? svn_wc_schedule_replace
- : svn_wc_schedule_add);
- SVN_ERR(svn_wc__entry_modify(db, local_abspath, svn_node_dir,
- &tmp_entry, modify_flags, scratch_pool));
-
- /* It's not enough to schedule it for addition with copyfrom args.
- We also need to rewrite all its BASE nodes to move them into WORKING. */
+ /* ### Temporary hack: Hook the inner working copy to the parent
+ working copy to work around that temp_op_make_copy() doesn't
+ add a working_node stub for its root if there is no base_node
+ stub. */
+ SVN_ERR(svn_wc__db_temp_set_parent_stub_to_normal(db, local_abspath,
+ FALSE, scratch_pool));
+ /* Transfer all nodes below LOCAL_ABSPATH from BASE_NODE to
+ WORKING_NODE */
SVN_ERR(svn_wc__db_temp_op_make_copy(db, local_abspath, TRUE,
scratch_pool));
-
- /* Set the WORKING_NODE properties from the values we saved earlier */
- SVN_ERR(svn_wc__db_temp_working_set_props(db, local_abspath, props,
- 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,
Modified: subversion/trunk/subversion/libsvn_wc/entries.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/entries.c?rev=959123&r1=959122&r2=959123&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/entries.c (original)
+++ subversion/trunk/subversion/libsvn_wc/entries.c Tue Jun 29 22:04:34 2010
@@ -2580,427 +2580,6 @@ write_one_entry(svn_wc__db_t *db,
scratch_pool));
}
-
-
-/* Update the entry CUR_ENTRY, according to the combination of
- entry data found in ENTRY and masked by MODIFY_FLAGS.
- The requested changes will be folded (merged) into
- the entry's existing state.
- Also cleanups meaningless fields combinations.
-
- PARENT_ENTRY must be passed, in order to grab certain "default" values.
-
- POOL will be used to allocate memory referenced by ENTRIES.
- */
-static svn_error_t *
-fold_entry(svn_wc_entry_t *cur_entry,
- const char *name,
- int modify_flags,
- const svn_wc_entry_t *entry,
- const svn_wc_entry_t *parent_entry,
- apr_pool_t *pool)
-{
- SVN_ERR_ASSERT(cur_entry != NULL);
- SVN_ERR_ASSERT(name != NULL);
- SVN_ERR_ASSERT(entry != NULL);
-
- /* Name (just a safeguard here, really) */
- if (! cur_entry->name)
- cur_entry->name = apr_pstrdup(pool, name);
-
- /* Revision and URL are no longer passed to entry_modify() */
-
- /* Kind */
- if (modify_flags & SVN_WC__ENTRY_MODIFY_KIND)
- cur_entry->kind = entry->kind;
-
- /* Schedule: handled by caller. */
-
- /* Checksum is no longer passed to entry_modify() */
-
- /* Copy-related stuff */
- if (modify_flags & SVN_WC__ENTRY_MODIFY_COPIED)
- cur_entry->copied = entry->copied;
-
- if (modify_flags & SVN_WC__ENTRY_MODIFY_COPYFROM_URL)
- cur_entry->copyfrom_url = entry->copyfrom_url
- ? apr_pstrdup(pool, entry->copyfrom_url)
- : NULL;
-
- if (modify_flags & SVN_WC__ENTRY_MODIFY_COPYFROM_REV)
- cur_entry->copyfrom_rev = entry->copyfrom_rev;
-
- /* Deleted and absent are no longer passed to entry_modify() */
-
- /* text_time, prop_time no longer passed to entry_modify() */
-
- /* Conflict stuff no longer passed to entry_modify() */
-
- /* Last-commit flags are no longer passed to entry_modify() */
-
- /* LOCK flags are no longer passed to entry_modify(). */
-
- /* changelist is no longer modified with this function. */
-
- /* has-props, prop-mods, cachable-props, and present-props are deprecated,
- so we do not copy them. */
-
- /* keep_local is no longer modified with this function */
-
- /* Note that we don't bother to fold entry->depth, because it is
- only meaningful on the this-dir entry anyway. */
-
- /* tree_conflict_data is never modified via entry_t. */
-
- /* Absorb defaults from the parent dir, if any, unless this is a
- subdir entry. */
- if (cur_entry->kind != svn_node_dir && parent_entry != NULL)
- {
- if ((cur_entry->revision == SVN_INVALID_REVNUM)
- && (cur_entry->kind != svn_node_dir))
- cur_entry->revision = parent_entry->revision;
- }
-
- /* Cleanup meaningless fields */
-
- /* ### svn_wc_schedule_delete is the minimal value. We need it because it's
- impossible to NULLify copyfrom_url with log-instructions.
-
- Note that I tried to find the smallest collection not to clear these
- fields for, but this condition still fails the test suite:
-
- !(entry->schedule == svn_wc_schedule_add
- || entry->schedule == svn_wc_schedule_replace
- || (entry->schedule == svn_wc_schedule_normal && entry->copied)))
-
- */
- if (modify_flags & SVN_WC__ENTRY_MODIFY_SCHEDULE
- && cur_entry->schedule == svn_wc_schedule_delete)
- {
- cur_entry->copied = FALSE;
- cur_entry->copyfrom_rev = SVN_INVALID_REVNUM;
- cur_entry->copyfrom_url = NULL;
- }
-
- /* working_size is no longer passed to entry_modify() */
-
- /* keep_local makes sense only when we are going to delete directory. */
- if (modify_flags & SVN_WC__ENTRY_MODIFY_SCHEDULE
- && cur_entry->schedule != svn_wc_schedule_delete)
- {
- cur_entry->keep_local = FALSE;
- }
-
- /* File externals are no longer passed to entry_modify(). */
-
- return SVN_NO_ERROR;
-}
-
-
-/* Our general purpose intelligence module for handling a scheduling change
- to a single entry.
-
- Given an ENTRY with name NAME, examine the caller's requested scheduling
- change and the current state of the entry and its directory entry
- THIS_DIR_ENTRY, which can be equal to ENTRY.
-
- Determine the final schedule for the entry based on NEW_SCHEDULE and the
- entries.
-
- The output can be:
- * *SKIP_SCHEDULE_CHANGE set to true, when no schedule change is necessary.
- * Or a schedule change.
-
- In all these cases *RESULT_SCHEDULE contains the new schedule value.
- */
-static svn_error_t *
-fold_scheduling(svn_boolean_t *skip_schedule_change,
- svn_wc_schedule_t *result_schedule,
- const svn_wc_entry_t *this_dir_entry,
- const svn_wc_entry_t *entry,
- svn_wc_schedule_t new_schedule,
- const char *name)
-{
- SVN_ERR_ASSERT(this_dir_entry);
- SVN_ERR_ASSERT(new_schedule != svn_wc_schedule_replace);
-
- *skip_schedule_change = FALSE;
- *result_schedule = new_schedule;
-
- /* The only operation valid on an item not already in revision
- control is addition. */
- if (entry == NULL)
- {
- if (new_schedule == svn_wc_schedule_add)
- return SVN_NO_ERROR;
-
- return svn_error_createf(SVN_ERR_WC_SCHEDULE_CONFLICT, NULL,
- _("'%s' is not under version control"),
- name);
- }
-
- /* At this point, we know the following things:
-
- 1. There is already an entry for this item in the entries file
- whose existence is either _normal or _added (or about to
- become such), which for our purposes mean the same thing.
-
- 2. We have been asked to merge in a state change, not to
- explicitly set the state. */
-
- /* Here are some cases that are parent-directory sensitive.
- Basically, we make sure that we are not allowing versioned
- resources to just sorta dangle below directories marked for
- deletion. */
- if ((entry != this_dir_entry)
- && (this_dir_entry->schedule == svn_wc_schedule_delete))
- {
- if (new_schedule == svn_wc_schedule_add)
- return
- svn_error_createf(SVN_ERR_WC_SCHEDULE_CONFLICT, NULL,
- _("Can't add '%s' to deleted directory; "
- "try undeleting its parent directory first"),
- name);
- }
-
- if (entry->absent && (new_schedule == svn_wc_schedule_add))
- {
- return svn_error_createf(SVN_ERR_WC_SCHEDULE_CONFLICT, NULL,
- _("'%s' is marked as absent, so it cannot "
- "be scheduled for addition"),
- name);
- }
-
- if (entry->schedule == svn_wc_schedule_normal
- && new_schedule == svn_wc_schedule_add
- && !entry->deleted)
- {
- /* You can't add something that's already been added to
- revision control... unless it's got a 'deleted' state */
- return svn_error_createf(SVN_ERR_WC_SCHEDULE_CONFLICT, NULL,
- _("Entry '%s' is already under version "
- "control"),
- name);
- }
-
- if (entry->schedule == svn_wc_schedule_normal)
- {
- if (new_schedule == svn_wc_schedule_normal)
- {
- /* No-op case. */
- *skip_schedule_change = TRUE;
- }
- }
- else if (entry->schedule == svn_wc_schedule_add)
- {
- if (new_schedule == svn_wc_schedule_normal
- || new_schedule == svn_wc_schedule_add)
- {
- /* These are both no-op cases. Normal is obvious, as is add.
-
- ### Neither case is obvious: above, we throw an error if
- ### already versioned, so why not here too?
- */
- *skip_schedule_change = TRUE;
- }
- else if (new_schedule == svn_wc_schedule_delete)
- {
- /* This is deleting a node added over the top of a not-present
- (DELETED=true) node. Return it to the not-present state. */
- /* ### not trying to delete the directory, and this is a
- ### not-present node. (otherwise, caller handles this case) */
- SVN_ERR_ASSERT(entry != this_dir_entry);
- SVN_ERR_ASSERT(entry->deleted);
-
- *result_schedule = svn_wc_schedule_normal;
- }
- }
- else if (entry->schedule == svn_wc_schedule_delete)
- {
- if (new_schedule == svn_wc_schedule_normal)
- {
- /* Reverting a delete results in normal */
- }
- else if (new_schedule == svn_wc_schedule_delete)
- {
- /* This is a no-op case */
- *skip_schedule_change = TRUE;
- }
- else if (new_schedule == svn_wc_schedule_add)
- {
- /* Re-adding an entry marked for deletion? This is really a
- replace operation. */
- *result_schedule = svn_wc_schedule_replace;
- }
- }
- else
- {
- /* Only possible state left. */
- SVN_ERR_ASSERT(entry->schedule == svn_wc_schedule_replace);
-
- if (new_schedule == svn_wc_schedule_normal)
- {
- /* Reverting replacements results in normal */
- }
- else if (new_schedule == svn_wc_schedule_add)
- {
- /* Adding a to-be-replaced entry breaks down to ((delete +
- add) + add) which might deserve a warning, but we'll just
- no-op it. */
- *skip_schedule_change = TRUE;
- }
- else if (new_schedule == svn_wc_schedule_delete)
- {
- /* Deleting a to-be-replaced entry breaks down to ((delete +
- add) + delete) which resolves to a flat deletion. */
- *result_schedule = svn_wc_schedule_delete;
- }
- }
-
- return SVN_NO_ERROR;
-}
-
-
-
-static svn_error_t *
-entry_modify(svn_wc__db_t *db,
- const char *local_abspath,
- svn_node_kind_t kind,
- svn_boolean_t parent_stub,
- const svn_wc_entry_t *entry_mods,
- int modify_flags,
- apr_pool_t *scratch_pool)
-{
- apr_pool_t *subpool = svn_pool_create(scratch_pool);
- svn_error_t *err;
- svn_wc_adm_access_t *adm_access;
- const char *adm_abspath;
- const char *name;
- const svn_wc_entry_t *parent_entry;
- svn_wc_entry_t *cur_entry;
- svn_wc_schedule_t new_schedule;
-
- SVN_ERR_ASSERT(entry_mods);
-
- SVN_ERR(get_entry_access_info(&adm_abspath, &name, db, local_abspath,
- kind, parent_stub, subpool, subpool));
-
- /* Load ADM_ABSPATH's whole entries file:
- Is there an existing access baton for this path? */
- adm_access = svn_wc__adm_retrieve_internal2(db, adm_abspath, subpool);
- if (adm_access != NULL)
- {
- /* Are we allowed to write to this admin area? */
- SVN_ERR(svn_wc__write_check(db, svn_wc__adm_access_abspath(adm_access),
- subpool));
-
- /* Zap any cached entries. We're about to change them. */
- svn_wc__adm_access_set_entries(adm_access, NULL);
- }
- /* ### else: should we have some kind of write check here? */
-
- /* Cast our non-const CUR_ENTRY appropriately. It will be allocated for
- us in SUB_POOL, so we actually know it is modifiable. */
- SVN_ERR(read_entry_pair(&parent_entry, (const svn_wc_entry_t **)&cur_entry,
- db, adm_abspath, name, subpool, subpool));
-
- if (modify_flags & SVN_WC__ENTRY_MODIFY_SCHEDULE)
- {
- new_schedule = entry_mods->schedule;
-
- /* We may just want to force the scheduling change in. Otherwise,
- call our special function to fold the change in. */
- if (!(modify_flags & SVN_WC__ENTRY_MODIFY_FORCE))
- {
- svn_boolean_t skip_schedule_change;
-
- /* ### adm_ops.c is the only code that attempts to transition to
- ### schedule_replace, but it uses FORCE. */
- SVN_ERR_ASSERT(entry_mods->schedule != svn_wc_schedule_replace);
-
- /* If we are deleting a node that has been added, then simply
- remove the entry. Do NOT do this for an add over a not-present
- BASE node (the DELETED flag). */
- if (entry_mods->schedule == svn_wc_schedule_delete
- && cur_entry != NULL
- && cur_entry->schedule == svn_wc_schedule_add
- && !cur_entry->deleted)
- {
- SVN_ERR(svn_wc__db_temp_op_remove_entry(db, local_abspath,
- subpool));
- svn_pool_destroy(subpool);
- return SVN_NO_ERROR;
- }
-
- /* If scheduling changes were made, we have a special routine to
- manage those modifications. */
- SVN_ERR(fold_scheduling(&skip_schedule_change,
- &new_schedule,
- parent_entry,
- cur_entry,
- entry_mods->schedule,
- name));
-
- if (skip_schedule_change)
- modify_flags &= ~SVN_WC__ENTRY_MODIFY_SCHEDULE;
- }
- }
-
- /* Yay! Our "modify" function can actually "create". Bleah. */
- if (cur_entry == NULL)
- cur_entry = alloc_entry(subpool);
-
- /* Fold in the changes, and write them out. */
- if (modify_flags & SVN_WC__ENTRY_MODIFY_SCHEDULE)
- cur_entry->schedule = new_schedule;
- SVN_ERR(fold_entry(cur_entry, name, modify_flags, entry_mods, parent_entry,
- subpool));
-
- err = write_one_entry(db, adm_abspath,
- parent_entry,
- cur_entry,
- subpool);
-
- svn_pool_destroy(subpool); /* Close wc.db handles */
-
- return svn_error_return(err);
-}
-
-
-svn_error_t *
-svn_wc__entry_modify(svn_wc__db_t *db,
- const char *local_abspath,
- svn_node_kind_t kind,
- const svn_wc_entry_t *entry,
- int modify_flags,
- apr_pool_t *scratch_pool)
-{
- return svn_error_return(entry_modify(db, local_abspath, kind, FALSE,
- entry, modify_flags, scratch_pool));
-}
-
-
-svn_error_t *
-svn_wc__entry_modify_stub(svn_wc__db_t *db,
- const char *local_abspath,
- const svn_wc_entry_t *entry,
- int modify_flags,
- apr_pool_t *scratch_pool)
-{
- SVN_ERR_ASSERT((modify_flags & ~(
- /* from adm_ops.c */
- SVN_WC__ENTRY_MODIFY_SCHEDULE
- | SVN_WC__ENTRY_MODIFY_KIND
- | SVN_WC__ENTRY_MODIFY_COPYFROM_URL
- | SVN_WC__ENTRY_MODIFY_COPYFROM_REV
- | SVN_WC__ENTRY_MODIFY_COPIED
- )) == 0);
- return svn_error_return(entry_modify(db, local_abspath,
- svn_node_dir, TRUE,
- entry, modify_flags, scratch_pool));
-}
-
-
svn_wc_entry_t *
svn_wc_entry_dup(const svn_wc_entry_t *entry, apr_pool_t *pool)
{
Modified: subversion/trunk/subversion/libsvn_wc/entries.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/entries.h?rev=959123&r1=959122&r2=959123&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/entries.h (original)
+++ subversion/trunk/subversion/libsvn_wc/entries.h Tue Jun 29 22:04:34 2010
@@ -37,63 +37,6 @@
extern "C" {
#endif /* __cplusplus */
-/* The MODIFY_FLAGS that tell svn_wc__entry_modify which parameters to
- pay attention to. ### These should track the changes made to the
- SVN_WC__ENTRY_ATTR_* #defines! */
-/* ### gap */
-#define SVN_WC__ENTRY_MODIFY_KIND 0x00000004
-/* ### gap */
-#define SVN_WC__ENTRY_MODIFY_SCHEDULE 0x00000020
-#define SVN_WC__ENTRY_MODIFY_COPIED 0x00000040
-#define SVN_WC__ENTRY_MODIFY_COPYFROM_URL 0x00000100
-#define SVN_WC__ENTRY_MODIFY_COPYFROM_REV 0x00000200
-/* ### gap */
-
-/* ...ORed together with this to mean: just set the schedule to the new
- value, instead of treating the new value as a change of state to be
- merged with the current schedule. */
-#define SVN_WC__ENTRY_MODIFY_FORCE 0x00020000
-
-
-/* Modify the entry for LOCAL_ABSPATH in DB by folding in
- ("merging") changes, and sync those changes to disk. New values
- for the entry are pulled from their respective fields in ENTRY, and
- MODIFY_FLAGS is a bitmask to specify which of those fields to pay
- attention to, formed from the values SVN_WC__ENTRY_MODIFY_....
-
- ### Old doc: "ADM_ACCESS must hold a write lock."
-
- If LOCAL_ABSPATH specifies a directory, its full entry will be modified.
- To modify its "parent stub" entry, use svn_wc__entry_modify_stub().
-
- "Folding in" a change means, in most cases, simply replacing the field
- with the new value. However, for the "schedule" field, unless
- MODIFY_FLAGS includes SVN_WC__ENTRY_MODIFY_FORCE (in which case just take
- the new schedule from ENTRY), it means to determine the schedule that the
- entry should end up with if the "schedule" value from ENTRY represents a
- change/add/delete/replace being made to the
- ### base / working / base and working version(s) ?
- of the node.
-
- Perform all allocations in SCRATCH_POOL.
-*/
-svn_error_t *
-svn_wc__entry_modify(svn_wc__db_t *db,
- const char *local_abspath,
- svn_node_kind_t kind,
- const svn_wc_entry_t *entry,
- int modify_flags,
- apr_pool_t *scratch_pool);
-
-
-/* Like svn_wc__entry_modify(), but modifies the "parent stub". */
-svn_error_t *
-svn_wc__entry_modify_stub(svn_wc__db_t *db,
- const char *local_abspath,
- const svn_wc_entry_t *entry,
- int modify_flags,
- 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).