Re: [PATCH] automatic properties
From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2003-09-30 02:39:36 CEST
Martin Furter wrote:
(The other way round - in adm_ops.c n svn_wc_add and commit.c in import_file.)
> When adding a file svn_wc_add() sets these properties and
Ah, yes. I missed that. I am glad that I was wrong. I was misled because there is no call to "svn_io_detect_mimetype" in subversion/libsvn_client/add.c. The call is at a lower level, in svn_wc_add.
The implementations of "svn_io_detect_mimetype" and "svn_io_is_file_executable" are in libsvn_wc because they ar WC-only operations. It seems to me that your new property-configuration function is very similar: it is also a WC-only operation, and so belongs with its two friends in libsvn_wc. I would make it like this:
/* Return a hash of configured AND detected properties together */
/* Detect mime-type and executable if they were not configured. */
/* Return all of these properties in a hash table. */
and then the two existing callers of "svn_io_is_file_executable"/"svn_io_detect_mime_type" would call the single new function instead of those two old functions:
import_file(...)
svn_wc_add(...)
This way, the logic of reading the configured properties and detecting two properties and having the former override the latter is all in one place, and there is only one call to each of editor->change_file_prop and svn_wc_prop_set rather than three of each.
The only remaining wrinkle is that the choice between "add" and "import" still has to be passed to svn_wc_get_auto_props(...). Now, you might not like this, but I'm going to suggest that the ability to enable auto-props for "add" but not "import" or vice-versa is not necessary. Not only is it not necessary, but it is not sufficient, because as soon as someone sees that they can enable one property during adds only, they will want to enable another property during commits ... without turning off the one for adds. I.e. I think that the ability to selectively _enable_ auto-props is not of very much use without being able to selectively _specify_ them. Of course it is of _some_ use; I don't dispute that. But enough use to justify the extra complication (small though it is)?
I hope you will agree that making this simplification to the configurability would actually improve the overall scheme.
>>>+/* Function which automatically adds configured properties.
Oh, it would only be good to split it into two functions if duplication of code can be avoided. In other words, there would have to be a third function which contains the code that would be common to both.
But, as I say, I think we can make this distinction go away
---------------------------------------------------------------------
|
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.