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

Re: [PATCH] automatic properties

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2003-09-29 20:27:33 CEST

Branko Čibej wrote:
> Martin Furter wrote:
>
>>+/* Method which automatically adds configured properties.
>>+
>>+ path, ctx and pool must always be valid. When adding adm_access must
>>+ be valid and editor must be NULL, when importing editor, file_baton,
>>+ mimetype and executable must be valid.
>>+
>>+ First the function checks that auto-props is enabled for add or import.
>>+ Then i enumerates the 'auto-props' section and tries to find fnmatches.
>>+ All matches found are parsed and the properties added to given path.
>>+
>>+ The format of the value is [propname[=value][;name[=val]]...]
>>+
>>+ @param path a filename
>>+ @param ctx the client context
>>+ @param pool apr memory pool
>>+ @param adm_access access baton, used when adding
>>+ @param editor editor, used when importing, must be NULL when adding
>>+ @param file_baton file baton for editor, used when importing
>>+ @param mimetype pointer for returning mimetype, used when importing
>>+ @param executable pointer for returning executable, used when importing
>>+ @return an svn_error_t or SVN_NO_ERROR when everything went OK
>>+*/
...
>
> Also, I'm a bit concerned about the overloading of the 'editor' param to
> differentiate between "svn add" and "svn import". It's dangerous
> practice, and confusing. Mush better to use a separate svn_boolean_t
> parameter instead, this way there's less danger of an inadvertent change
> in behaviour if the semantics of the parameter change. There are far too
> many rules here about which parameters must be set in different situations.

The large difference between parameters needed for "add" and parameters needed for "import" would seem to indicate that two separate functions would be more appropriate (with the common parts of their implementation factored out, of course). Something like:

  svn_error_t *
  svn_client__add_auto_props_for_add (const char *path,
                                      svn_client_ctx_t *ctx,
                                      svn_wc_adm_access_t *adm_access,
                                      apr_pool_t *pool);

  svn_error_t *
  svn_client__add_auto_props_for_import (const char *path,
                                         svn_client_ctx_t *ctx,
                                         const svn_delta_editor_t *editor,
                                         void *file_baton,
                                         const char **mimetype,
                                         int *executable,
                                         apr_pool_t *pool);

- Julian

...
>>+svn_error_t *
>>+svn_client__add_auto_props (const char *path,
>>+ svn_client_ctx_t *ctx,
>>+ apr_pool_t *pool,
>>+ svn_wc_adm_access_t *adm_access,
>>+ const svn_delta_editor_t *editor,
>>+ void *file_baton,
>>+ const char **mimetype,
>>+ int *executable);
>>+

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Sep 29 20:27:23 2003

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.