Hi,
We've started to use Subversion on a few projects in-house. It's working
well in conjunction with TortoiseSVN - kudos to both Subversion and
TorotoiseSVN teams!
We have been using Subversion since locking was introduced in 1.2. Our
file set mostly consists of large text-only resource files (+10Mb) which
cannot be sensibly merged, we are having to enforce locking for all file
types but a specific set of file types (code files mostly).
We have been using the "auto-props" feature to ensure the "needs-lock"
and mime-types are set appropriately. But the number of file extensions
we have comes to a couple of hundred (historical reasons mostly!), which
is a headache to maintain at times.
Feature request is for an option ("empty-auto-props") that applies a
specified set of properties to a file if none of the patterns listed
under [auto-props] have matched[1] or where no properties have been set[2].
I've attached a diff (emptyautoprops-1.2.3.diff patch against 1.2.3) for
[2] above and an example "config" file, these work for our situation and
cuts the config file down to 16 lines.
This doesn't handle the case of when you don't want _any_ properties to
be set for a particular file pattern match.
* subversion/include/svn_config.h
(SVN_CONFIG_OPTION_EMPTY_AUTO_PROPS): New define.
* subversion/libsvn_client/add.c
(svn_client__get_auto_props): adds empty-auto-props properties to a
file if [auto-props] sections doesn't add any
Also attached "emptyautoprops-Trunk.diff", patched against the trunk,
but hasn't been tested.
Would certainly hope something like this "catch-all" option could also
be included as part of the "Repository-defined autoprops" mentioned in
the Roadmap.
Thanks
David Fairey
Index: subversion/include/svn_config.h
===================================================================
--- subversion/include/svn_config.h (revision 18219)
+++ subversion/include/svn_config.h (working copy)
@@ -87,6 +87,7 @@
#define SVN_CONFIG_OPTION_USE_COMMIT_TIMES "use-commit-times"
#define SVN_CONFIG_OPTION_TEMPLATE_ROOT "template-root"
#define SVN_CONFIG_OPTION_ENABLE_AUTO_PROPS "enable-auto-props"
+#define SVN_CONFIG_OPTION_EMPTY_AUTO_PROPS "empty-auto-props"
#define SVN_CONFIG_OPTION_NO_UNLOCK "no-unlock"
#define SVN_CONFIG_SECTION_TUNNELS "tunnels"
#define SVN_CONFIG_SECTION_AUTO_PROPS "auto-props"
Index: subversion/libsvn_client/add.c
===================================================================
--- subversion/libsvn_client/add.c (revision 18219)
+++ subversion/libsvn_client/add.c (working copy)
@@ -150,6 +150,7 @@
svn_config_t *cfg;
svn_boolean_t use_autoprops;
auto_props_baton_t autoprops;
+ const char *empty_autoprops;
/* initialisation */
autoprops.properties = apr_hash_make (pool);
@@ -169,9 +170,22 @@
/* search for auto props */
if (use_autoprops)
- svn_config_enumerate2 (cfg, SVN_CONFIG_SECTION_AUTO_PROPS,
- auto_props_enumerator, &autoprops, pool);
+ {
+ svn_config_enumerate2 (cfg, SVN_CONFIG_SECTION_AUTO_PROPS,
+ auto_props_enumerator, &autoprops, pool);
+ /* if no props have been set use the empty auto props */
+ if (apr_hash_count(autoprops.properties) == 0)
+ {
+ /* Check Subversion's run-time config for empty auto props */
+ svn_config_get (cfg, &empty_autoprops, SVN_CONFIG_SECTION_MISCELLANY,
+ SVN_CONFIG_OPTION_EMPTY_AUTO_PROPS, NULL);
+
+ if (empty_autoprops != NULL)
+ auto_props_enumerator ("*", empty_autoprops, &autoprops);
+ }
+ }
+
/* if mimetype has not been set check the file */
if (! autoprops.mimetype)
{
Index: subversion/include/svn_config.h
===================================================================
--- subversion/include/svn_config.h (revision 18204)
+++ subversion/include/svn_config.h (working copy)
@@ -85,6 +85,7 @@
#define SVN_CONFIG_OPTION_USE_COMMIT_TIMES "use-commit-times"
#define SVN_CONFIG_OPTION_TEMPLATE_ROOT "template-root"
#define SVN_CONFIG_OPTION_ENABLE_AUTO_PROPS "enable-auto-props"
+#define SVN_CONFIG_OPTION_EMPTY_AUTO_PROPS "empty-auto-props"
#define SVN_CONFIG_OPTION_NO_UNLOCK "no-unlock"
#define SVN_CONFIG_SECTION_TUNNELS "tunnels"
#define SVN_CONFIG_SECTION_AUTO_PROPS "auto-props"
Index: subversion/libsvn_client/add.c
===================================================================
--- subversion/libsvn_client/add.c (revision 18204)
+++ subversion/libsvn_client/add.c (working copy)
@@ -150,6 +150,7 @@
svn_config_t *cfg;
svn_boolean_t use_autoprops;
auto_props_baton_t autoprops;
+ const char *empty_autoprops;
/* initialisation */
autoprops.properties = apr_hash_make (pool);
@@ -169,9 +170,22 @@
/* search for auto props */
if (use_autoprops)
- svn_config_enumerate (cfg, SVN_CONFIG_SECTION_AUTO_PROPS,
- auto_props_enumerator, &autoprops);
+ {
+ svn_config_enumerate (cfg, SVN_CONFIG_SECTION_AUTO_PROPS,
+ auto_props_enumerator, &autoprops);
+ /* if no props have been set use the empty auto props */
+ if (apr_hash_count(autoprops.properties) == 0)
+ {
+ /* Check Subversion's run-time config for empty auto props */
+ svn_config_get (cfg, &empty_autoprops, SVN_CONFIG_SECTION_MISCELLANY,
+ SVN_CONFIG_OPTION_EMPTY_AUTO_PROPS, NULL);
+
+ if (empty_autoprops != NULL)
+ auto_props_enumerator ("*", empty_autoprops, &autoprops);
+ }
+ }
+
/* if mimetype has not been set check the file */
if (! autoprops.mimetype)
{
### This file configures various client-side behaviors.
###
### The commented-out examples below are intended to demonstrate
### how to use this file.
### Section for authentication and authorization customizations.
[auth]
### Set store-passwords to 'no' to avoid storing passwords in the
### auth/ area of your config directory. It defaults to 'yes'.
### Note that this option only prevents saving of *new* passwords;
### it doesn't invalidate existing passwords. (To do that, remove
### the cache files by hand as described in the Subversion book.)
# store-passwords = no
### Set store-auth-creds to 'no' to avoid storing any subversion
### credentials in the auth/ area of your config directory.
### It defaults to 'yes'. Note that this option only prevents
### saving of *new* credentials; it doesn't invalidate existing
### caches. (To do that, remove the cache files by hand.)
# store-auth-creds = no
### Section for configuring external helper applications.
[helpers]
### Set editor to the command used to invoke your text editor.
### This will override the environment variables that Subversion
### examines by default to find this information ($EDITOR,
### et al).
# editor-cmd = editor (vi, emacs, notepad, etc.)
### Set diff-cmd to the absolute path of your 'diff' program.
### This will override the compile-time default, which is to use
### Subversion's internal diff implementation.
# diff-cmd = diff_program (diff, gdiff, etc.)
### Set diff3-cmd to the absolute path of your 'diff3' program.
### This will override the compile-time default, which is to use
### Subversion's internal diff3 implementation.
# diff3-cmd = diff3_program (diff3, gdiff3, etc.)
### Set diff3-has-program-arg to 'true' or 'yes' if your 'diff3'
### program accepts the '--diff-program' option.
# diff3-has-program-arg = [true | false]
### Section for configuring tunnel agents.
[tunnels]
### Configure svn protocol tunnel schemes here. By default, only
### the 'ssh' scheme is defined. You can define other schemes to
### be used with 'svn+scheme://hostname/path' URLs. A scheme
### definition is simply a command, optionally prefixed by an
### environment variable name which can override the command if it
### is defined. The command (or environment variable) may contain
### arguments, using standard shell quoting for arguments with
### spaces. The command will be invoked as:
### <command> <hostname> svnserve -t
### (If the URL includes a username, then the hostname will be
### passed to the tunnel agent as <user>@<hostname>.) If the
### built-in ssh scheme were not predefined, it could be defined
### as:
# ssh = $SVN_SSH ssh
### If you wanted to define a new 'rsh' scheme, to be used with
### 'svn+rsh:' URLs, you could do so as follows:
# rsh = rsh
### Or, if you wanted to specify a full path and arguments:
# rsh = /path/to/rsh -l myusername
### On Windows, if you are specifying a full path to a command,
### use a forward slash (/) or a paired backslash (\\) as the
### path separator. A single backslash will be treated as an
### escape for the following character.
### Section for configuring miscelleneous Subversion options.
[miscellany]
### Set global-ignores to a set of whitespace-delimited globs
### which Subversion will ignore in its 'status' output, and
### while importing or adding files and directories.
# global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store
### Set log-encoding to the default encoding for log messages
# log-encoding = latin1
### Set use-commit-times to make checkout/update/switch/revert
### put last-committed timestamps on every file touched.
# use-commit-times = yes
### Set no-unlock to prevent 'svn commit' from automatically
### releasing locks on files.
# no-unlock = yes
### Set enable-auto-props to 'yes' to enable automatic properties
### for 'svn add' and 'svn import', it defaults to 'no'.
### Automatic properties are defined in the section 'auto-props'.
enable-auto-props = yes
empty-auto-props = svn:needs-lock=*;svn:mime-type=application/octet-stream
### Section for configuring automatic properties.
[auto-props]
### The format of the entries is:
### file-name-pattern = propname[=value][;propname[=value]...]
### The file-name-pattern can contain wildcards (such as '*' and
### '?'). All entries which match will be applied to the file.
### Note that auto-props functionality must be enabled, which
### is typically done by setting the 'enable-auto-props' option.
*.c = svn:eol-style=native;svn:mime-type=text/plain
*.cpp = svn:eol-style=native;svn:mime-type=text/plain
*.h = svn:eol-style=native;svn:mime-type=text/plain
*.dsp = svn:eol-style=CRLF
*.dsw = svn:eol-style=CRLF
*.txt = svn:eol-style=native
*.xml = svn:mime-type=text/plain
^[mM]akefile = svn:eol-style=native
*.js = svn:mime-type=text/plain
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jan 25 22:31:57 2006