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

Re: [PATCH] [Issue 1751] file not switched if it is the same in source and destination

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2004-03-21 17:48:26 CET

makl <makl@tigris.org> writes:

> [[[
> Fix file not switched if it is the same in source and destination
>
> Patch from <makl@tigris.org>
>
> * subversion/tests/clients/cmdline/switch_tests.py
> (main): Remove XFAIL from nonrecursive_switching
> (nonrecursive_switching): Extend the test to ensure that
> subdirectories are not switched.
>
> * subversion/libsvn_wc/adm_ops.c
> (non_recursively_tweak_entries): New function similar to
> recursively_tweak_entries but non recursive.

I feel there is too much code duplication, would it be possible to use
a single tweak_entries function with a recurse flag?

> (svn_wc__do_update_cleanup): Call non_recursively_tweak_entries
> ]]]
>
>
> Index: subversion/libsvn_wc/adm_ops.c
> ===================================================================
> --- subversion/libsvn_wc/adm_ops.c (revision 9041)
> +++ subversion/libsvn_wc/adm_ops.c (working copy)
> @@ -161,6 +161,69 @@
>
>
> +/* The main non-recursive body of svn_wc__do_update_cleanup. */
> +static svn_error_t *
> +non_recursively_tweak_entries (svn_wc_adm_access_t *dirpath,
> + const char *base_url,
> + svn_revnum_t new_rev,
> + apr_pool_t *pool)
> +{
> + apr_hash_t *entries;
> + apr_hash_index_t *hi;
> + apr_pool_t *subpool = svn_pool_create (pool);
> + svn_boolean_t write_required = FALSE;
> +
> + /* Read DIRPATH's entries. */
> + SVN_ERR (svn_wc_entries_read (&entries, dirpath, TRUE, subpool));

I know you copied this code, but the pool handling isn't correct.
It should be using pool here, not subpool.

> +
> + /* Tweak "this_dir" */
> + SVN_ERR (svn_wc__tweak_entry (entries, SVN_WC_ENTRY_THIS_DIR,
> + base_url, new_rev, &write_required,
> + svn_wc_adm_access_pool (dirpath)));
> +
> + /* Recursively loop over all children. */
> + for (hi = apr_hash_first (subpool, entries); hi; hi = apr_hash_next (hi))

Use pool here.

> + {
> + const void *key;
> + void *val;
> + const char *name;
> + svn_wc_entry_t *current_entry;
> + const char *child_url = NULL;
> +

Add svn_pool_clear here.

> + apr_hash_this (hi, &key, NULL, &val);
> + name = key;
> + current_entry = val;
> +
> + /* Ignore the "this dir" entry. */
> + if (! strcmp (name, SVN_WC_ENTRY_THIS_DIR))
> + continue;
> +
> + /* Derive the new URL for the current (child) entry */
> + if (base_url)
> + child_url = svn_path_url_add_component (base_url, name, subpool);
> +
> + /* If a file, or deleted or absent dir, then tweak the entry but
> + don't recurse. */
> + if (current_entry->kind == svn_node_file)
> + {
> + SVN_ERR (svn_wc__tweak_entry (entries, name,
> + child_url, new_rev, &write_required,
> + svn_wc_adm_access_pool (dirpath)));
> + }
> + }
> +
> + /* Write a shiny new entries file to disk. */
> + if (write_required)
> + SVN_ERR (svn_wc__entries_write (entries, dirpath, subpool));
> +

> Index: subversion/tests/clients/cmdline/switch_tests.py
> ===================================================================
> --- subversion/tests/clients/cmdline/switch_tests.py (revision 9041)
> +++ subversion/tests/clients/cmdline/switch_tests.py (working copy)
> @@ -636,9 +636,12 @@
> wc1_new_file = os.path.join(wc1_dir, 'branch', 'version1', 'newfile')
> wc2_new_file = os.path.join(wc2_dir, 'newfile')
> wc2_mu_file = os.path.join(wc2_dir, 'mu')
> + wc2_B_dir = os.path.join(wc2_dir, 'B')
> + wc2_C_dir = os.path.join(wc2_dir, 'C')
> + wc2_D_dir = os.path.join(wc2_dir, 'D')
>
> # Check out the trunk as "wc2"
> - svntest.main.run_svn(None, 'co', '-N', trunk_url, wc2_dir)
> + svntest.main.run_svn(None, 'co', trunk_url, wc2_dir)

That's quite a change, is this test still testing whatever it was
supposed to test originally?

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Mar 21 17:48:43 2004

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.