[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: Greg Stein <gstein_at_gmail.com>
Date: Wed, 23 Sep 2009 15:50:14 -0400

This change now makes merge_tests 134 pass (which was marked as an
XFail). I'm not really sure how it was failing before (RANT: the were
no comments in the test case saying "it fails <here> because <this>").

That test is apparently for issue #2690.

Can a merge person take a look?

Cheers,
-g

On Wed, Sep 23, 2009 at 15:40, Greg Stein <gstein_at_gmail.com> wrote:
> 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?pathrev=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?pathrev=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 (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;
>     }
>
>   if ((SVN_IS_VALID_REVNUM(new_rev))
> @@ -3069,7 +3041,8 @@ svn_wc__tweak_entry(svn_wc__db_t *db,
>       && (entry->copied != TRUE)
>       && (entry->revision != new_rev))
>     {
> -      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
> @@ -3090,12 +3063,15 @@ svn_wc__tweak_entry(svn_wc__db_t *db,
>   if (allow_removal
>       && (entry->deleted || (entry->absent && entry->revision != new_rev)))
>     {
> -      apr_hash_set(entries, name, APR_HASH_KEY_STRING, NULL);
> +      SVN_ERR(svn_wc__entry_remove(db, local_abspath, scratch_pool));
> +    }
> +  else if (modify_flags)
> +    {
> +      SVN_ERR(svn_wc__entry_modify2(db, local_abspath, entry->kind, tweak_stub,
> +                                    &tmp_entry, modify_flags, scratch_pool));
>     }
>
> -  return svn_error_return(
> -    entries_write(entries, db, this_dir ? local_abspath : parent_dir,
> -                  scratch_pool));
> +  return SVN_NO_ERROR;
>  }
>
>
>
> Modified: trunk/subversion/libsvn_wc/entries.h
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/entries.h?pathrev=39546&r1=39545&r2=39546
> ==============================================================================
> --- trunk/subversion/libsvn_wc/entries.h        Wed Sep 23 11:36:47 2009        (r39545)
> +++ trunk/subversion/libsvn_wc/entries.h        Wed Sep 23 12:40:53 2009        (r39546)
> @@ -211,9 +211,10 @@ svn_wc__entry_remove(svn_wc__db_t *db,
>  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);
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=2399046
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2399047
Received on 2009-09-23 21:50:30 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.