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

Re: svn commit: r34057 - in trunk/subversion: libsvn_wc tests/cmdline

From: Greg Stein <gstein_at_gmail.com>
Date: Tue, 4 Nov 2008 20:54:14 -0800

On Tue, Nov 4, 2008 at 4:12 PM, <julianfoad_at_tigris.org> wrote:
>...
> +++ trunk/subversion/libsvn_wc/adm_ops.c Tue Nov 4 16:12:43 2008 (r34057)
>...
> + /* Safeguard 1: the item must be versioned for any reversion to make sense,
> + except that a tree conflict can exist on an unversioned item. */
> + SVN_ERR(svn_wc_entry(&entry, path, dir_access, FALSE, pool));
> + SVN_ERR(svn_wc_get_tree_conflict(&tree_conflict, path, dir_access, pool));
> + if (entry == NULL && tree_conflict == NULL)
> + return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,
> + _("Cannot revert unversioned item '%s'"), path);
>
> /* Safeguard 1.5: is this a missing versioned directory? */
> - if (entry->kind == svn_node_dir)
> + if (entry && (entry->kind == svn_node_dir))
> {
> svn_node_kind_t disk_kind;
> SVN_ERR(svn_io_check_path(path, &disk_kind, pool));
> @@ -2195,7 +2190,7 @@ revert_internal(const char *path,
> }
>
> /* Safeguard 2: can we handle this entry's recorded kind? */
> - if ((entry->kind != svn_node_file) && (entry->kind != svn_node_dir))
> + if (entry && (entry->kind != svn_node_file) && (entry->kind != svn_node_dir))
> return svn_error_createf
> (SVN_ERR_UNSUPPORTED_FEATURE, NULL,
> _("Cannot revert '%s': unsupported entry node kind"),
> @@ -2215,15 +2210,34 @@ revert_internal(const char *path,
> /* If the entry passes changelist filtering, revert it! */
> if (SVN_WC__CL_MATCH(changelist_hash, entry))
> {
> + svn_boolean_t reverted = FALSE;
> + svn_wc_conflict_description_t *conflict;
> +
> + /* Clear any tree conflict on the path, even if it is not a versioned
> + resource. */
> + SVN_ERR(svn_wc_get_tree_conflict(&conflict, path, parent_access, pool));

Didn't you do this just above? And does that "conflict" declaration
shadow the other?

>...
> + if (entry)

There are a lot of extra tests now for entry being NULL or not. Is it
possible to just test once, check the tree conflict stuff for the
unversioned item, and *exit early* ? Simplifying all of these tests
can really help to reduce complexity.

Cheers,
-g

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-11-05 05:54:31 CET

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.