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

Re: [PATCH] : issue #1584 : Prevent revision props on files/dirs

From: <kfogel_at_collab.net>
Date: 2003-11-18 20:17:41 CET

David Kimdon <david@kimdon.org> writes:
> Here's a patch. +1 ?

+1 -- and I like the trick with SVN_PROP_REVISION_ALL_PROPS, I'd never
seen that done before :-).

> -----------------------
>
> Fix issue #1584 : Prevent 'svn:' revision props from being set on files/dirs
>
> * subversion/libsvn_client/prop_commands.c
> (is_revision_prop_name) : New function.
> (svn_client_propset) : Refuse to set revision properties (revision
> properties are set in svn_client_revprop_set())
>
> Index: subversion/include/svn_props.h
> ===================================================================
> --- subversion/include/svn_props.h (revision 7781)
> +++ subversion/include/svn_props.h (working copy)
> @@ -276,6 +276,14 @@
> */
> #define SVN_PROP_REVISION_ORIG_DATE SVN_PROP_PREFIX "original-date"
>
> +/*
> + * This is a list of all revision properties.
> + */
> +#define SVN_PROP_REVISION_ALL_PROPS SVN_PROP_REVISION_AUTHOR, \
> + SVN_PROP_REVISION_LOG, \
> + SVN_PROP_REVISION_DATE, \
> + SVN_PROP_REVISION_ORIG_DATE,
> +
> /** @} */
>
>
> Index: subversion/libsvn_client/prop_commands.c
> ===================================================================
> --- subversion/libsvn_client/prop_commands.c (revision 7781)
> +++ subversion/libsvn_client/prop_commands.c (working copy)
> @@ -57,6 +57,29 @@
> }
>
>
> +/* Check whether NAME is a revision property name.
> + *
> + * Return TRUE if it is.
> + * Return FALSE if it is not.
> + */
> +static svn_boolean_t
> +is_revision_prop_name (const char *name)
> +{
> + int i;
> + const char *revision_props[] =
> + {
> + SVN_PROP_REVISION_ALL_PROPS
> + NULL,
> + };
> +
> + for (i = 0; revision_props[i]; i++)
> + {
> + if (strcmp (name, revision_props[i]) == 0)
> + return TRUE;
> + }
> + return FALSE;
> +}
> +
> /* A baton for propset_walk_cb. */
> struct propset_walk_baton
> {
> @@ -113,6 +136,13 @@
> svn_wc_adm_access_t *adm_access;
> const svn_wc_entry_t *node;
>
> + if (is_revision_prop_name (propname))
> + {
> + return svn_error_createf (SVN_ERR_CLIENT_PROPERTY_NAME, NULL,
> + "Revision property '%s' not allowed "
> + "in this context", propname);
> + }
> +
> if (svn_path_is_url (target))
> {
> /* ### Note that this function will need to take an auth baton
> Index: subversion/tests/clients/cmdline/prop_tests.py
> ===================================================================
> --- subversion/tests/clients/cmdline/prop_tests.py (revision 7781)
> +++ subversion/tests/clients/cmdline/prop_tests.py (working copy)
> @@ -549,6 +549,26 @@
> 'svn:externals',
> 'foo http://host.com/repos', iota_path)
>
> + svntest.actions.run_and_verify_svn('Illegal target', None,
> + svntest.SVNAnyOutput, 'propset',
> + 'svn:author', 'socrates', iota_path)
> +
> + svntest.actions.run_and_verify_svn('Illegal target', None,
> + svntest.SVNAnyOutput, 'propset',
> + 'svn:log', 'log message', iota_path)
> +
> + svntest.actions.run_and_verify_svn('Illegal target', None,
> + svntest.SVNAnyOutput, 'propset',
> + 'svn:date',
> + 'Tue Jan 19 04:14:07 2038',
> + iota_path)
> +
> + svntest.actions.run_and_verify_svn('Illegal target', None,
> + svntest.SVNAnyOutput, 'propset',
> + 'svn:original-date',
> + 'Thu Jan 1 01:00:00 1970',
> + iota_path)
> +
> # Status unchanged
> svntest.actions.run_and_verify_status(wc_dir, expected_status)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Nov 18 21:01:14 2003

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