[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: svn commit: r39546 - trunk/subversion/libsvn_wc

From: Bert Huijben <rhuijben_at_sharpsvn.net>
Date: Thu, 24 Sep 2009 13:10:21 +0200

> -----Original Message-----
> From: Greg Stein [mailto:gstein_at_gmail.com]
> Sent: woensdag 23 september 2009 21:41
> To: svn_at_subversion.tigris.org
> Subject: svn commit: r39546 - trunk/subversion/libsvn_wc
>
> Author: gstein
> Date: Wed Sep 23 12:40:53 2009
> New Revision: 39546
>
> Log:
> Rewrite svn_wc__tweak_entry() in terms of other entry-modifying
> functions
> rather than calling entries_write() itself. It also removes some access
> baton and entries-hash reading code for bonus happy points.
>
> * subversion/libsvn_wc/entries.c:
> (svn_wc__tweak_entry): adjust the params to help us out with a call
> to
> get_entry(). the caller has this data, so passing it is good.
> remove
> the entries hash and fetch the target entry for reading. any
> changes
> go into a standard TMP_ENTRY/MODIFY_FLAGS set for later passing to
> entry_modify2(). don't modify the entry in-place, but do entries
> modifications via modify2() and entry_remove().
>
> * subversion/libsvn_wc/entries.h:
> (svn_wc__tweak_entry): follow the param adjustments
>
> * subversion/libsvn_wc/adm_ops.c:
> (tweak_entries): when modifying THIS_DIR, pass the proper (new) flags
> for the tweak_entry call. for non-recursing children, adjust the
> flags
> properly, noting that we'll be modifying the parent stub for dirs.
> (svn_wc__do_update_cleanup): don't skip the parent stub by absorbing
> the
> error from get_entry(). do the explicit change. adjust/clarify the
> error handling. adjust the params for the non-recursive file case.
>
> Modified:
> trunk/subversion/libsvn_wc/adm_ops.c
> trunk/subversion/libsvn_wc/entries.c
> trunk/subversion/libsvn_wc/entries.h
>
> Modified: trunk/subversion/libsvn_wc/adm_ops.c
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/adm_ops.c?p
> athrev=39546&r1=39545&r2=39546
> =======================================================================
> =======
> --- trunk/subversion/libsvn_wc/adm_ops.c Wed Sep 23 11:36:47 2009
> (r39545)
> +++ trunk/subversion/libsvn_wc/adm_ops.c Wed Sep 23 12:40:53 2009
> (r39546)
> @@ -112,8 +112,9 @@ tweak_entries(svn_wc__db_t *db,
> return SVN_NO_ERROR;
>
> /* Tweak "this_dir" */
> - SVN_ERR(svn_wc__tweak_entry(db, dir_abspath, base_url, new_rev,
> - TRUE, FALSE /* allow_removal */, pool));
> + SVN_ERR(svn_wc__tweak_entry(db, dir_abspath, FALSE, svn_node_dir,
> + base_url, new_rev,
> + FALSE /* allow_removal */, pool));
>
> if (depth == svn_depth_unknown)
> depth = svn_depth_infinity;
> @@ -163,10 +164,18 @@ tweak_entries(svn_wc__db_t *db,
> || status == svn_wc__db_status_absent
> || child_depth == svn_depth_exclude)
> {
> - if (! excluded)
> - SVN_ERR(svn_wc__tweak_entry(db, child_abspath,
> - child_url, new_rev,
> - FALSE, TRUE /* allow_removal
> */,
> + if (excluded)
> + continue;
> +
> + if (kind == svn_wc__db_kind_dir)
> + SVN_ERR(svn_wc__tweak_entry(db, child_abspath, TRUE,
> + svn_node_dir, child_url,
> new_rev,
> + TRUE /* allow_removal */,
> + pool));
> + else
> + SVN_ERR(svn_wc__tweak_entry(db, child_abspath, FALSE,
> + svn_node_file, child_url,
> new_rev,
> + TRUE /* allow_removal */,
> pool));
> }
>
> @@ -275,26 +284,36 @@ svn_wc__do_update_cleanup(svn_wc__db_t *
>
> err = svn_wc__get_entry(&entry, db, local_abspath, TRUE,
> svn_node_unknown,
> FALSE, pool, pool);
> - if ((err && err->apr_err == SVN_ERR_NODE_UNEXPECTED_KIND) || (entry
> == NULL))
> + if (err)
> {
> + if (err->apr_err != SVN_ERR_NODE_UNEXPECTED_KIND)
> + return svn_error_return(err);
> +
> + /* We got the parent stub instead. That's fine... just tweak it
> + and avoid directory recursion. */
> svn_error_clear(err);
> +
> + if (apr_hash_get(exclude_paths, local_abspath,
> APR_HASH_KEY_STRING))
> + return SVN_NO_ERROR;
> +
> + SVN_ERR(svn_wc__tweak_entry(db, local_abspath, TRUE,
> svn_node_dir,
> + base_url, new_revision,
> + FALSE /* allow_removal */,
> + pool));
> return SVN_NO_ERROR;
> }
> - else if (err)
> - return svn_error_return(err);
> + if (entry == NULL)
> + return SVN_NO_ERROR;
>
> - if (entry->kind == svn_node_file
> - || (entry->kind == svn_node_dir
> - && (entry->deleted || entry->absent
> - || entry->depth == svn_depth_exclude)))
> + if (entry->kind == svn_node_file)
> {
> if (apr_hash_get(exclude_paths, local_abspath,
> APR_HASH_KEY_STRING))
> return SVN_NO_ERROR;
>
> /* Parent not updated so don't remove PATH entry. */
> - SVN_ERR(svn_wc__tweak_entry(db, local_abspath,
> + SVN_ERR(svn_wc__tweak_entry(db, local_abspath, FALSE,
> svn_node_file,
> base_url, new_revision,
> - FALSE, FALSE /* allow_removal */,
> + FALSE /* allow_removal */,
> pool));
> }
>
>
> Modified: trunk/subversion/libsvn_wc/entries.c
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/entries.c?p
> athrev=39546&r1=39545&r2=39546
> =======================================================================
> =======
> --- trunk/subversion/libsvn_wc/entries.c Wed Sep 23 11:36:47 2009
> (r39545)
> +++ trunk/subversion/libsvn_wc/entries.c Wed Sep 23 12:40:53 2009
> (r39546)
> @@ -112,15 +112,6 @@ typedef struct {
>
>
>

> -
> -static svn_error_t *
> -entries_write(apr_hash_t *entries,
> - svn_wc__db_t *db,
> - const char *adm_abspath,
> - apr_pool_t *scratch_pool);
> -
> -
> -

> /*** reading and writing the entries file ***/
>
>
> @@ -3023,44 +3014,25 @@ 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_boolean_t tweak_stub,
> + svn_node_kind_t kind,
> const char *new_url,
> svn_revnum_t new_rev,
> - svn_boolean_t this_dir,
> svn_boolean_t allow_removal,
> apr_pool_t *scratch_pool)
> {
> - apr_hash_t *entries;
> - svn_wc_entry_t *entry;
> - const char *name;
> - svn_wc_adm_access_t *adm_access;
> - apr_pool_t *state_pool;
> - const char *parent_dir;
> + const svn_wc_entry_t *entry;
> + svn_wc_entry_t tmp_entry;
> + apr_uint64_t modify_flags = 0;
>
> - svn_dirent_split(local_abspath, &parent_dir, &name, scratch_pool);
> -
> - if (this_dir)
> - {
> - name = SVN_WC_ENTRY_THIS_DIR;
> - adm_access = svn_wc__adm_retrieve_internal2(db, local_abspath,
> - scratch_pool);
> - }
> - else
> - {
> - adm_access = svn_wc__adm_retrieve_internal2(db, parent_dir,
> - scratch_pool);
> - }
> -
> - state_pool = svn_wc_adm_access_pool(adm_access);
> - SVN_ERR(svn_wc_entries_read(&entries, adm_access, TRUE,
> scratch_pool));
> - entry = apr_hash_get(entries, name, APR_HASH_KEY_STRING);
> - if (! entry)
> - return svn_error_createf(SVN_ERR_ENTRY_NOT_FOUND, NULL,
> - _("No such entry: '%s'"), name);
> + SVN_ERR(svn_wc__get_entry(&entry, db, local_abspath, FALSE, kind,
> tweak_stub,
> + scratch_pool, scratch_pool));

If we are updating a directory here the old code sometimes reads the stub, and sometimes the directory. The new code always reads the entry from the directory.

This is probably the change that fixed the merge test, because the url is always(?) available in the directory itself, but can be inherited in the stub.

>
> if (new_url != NULL
> && (! entry->url || strcmp(new_url, entry->url)))
> {
> - entry->url = apr_pstrdup(state_pool, new_url);
> + modify_flags |= SVN_WC__ENTRY_MODIFY_URL;
> + tmp_entry.url = new_url;
> }

And this code then detects: Hey, that is not a url change.

So it might also be the case that we forget to update the url in the parent stub.

        Bert

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2399236
Received on 2009-09-24 13:11:22 CEST

This is an archived mail posted to the Subversion Dev mailing list.