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

Re: [PROPOSAL] Change of convention for multiline string literals

From: Jonathan Gilbert <o2w9gs702_at_sneakemail.com>
Date: 2007-04-22 07:25:27 CEST

At 11:58 PM 3/27/2007 +0100, Max wrote:
>Jonathan Gilbert wrote:
>> At 10:12 PM 3/18/2007 -0500, I wrote:
>> [snip]
>>> In light of this, I would like to revise my proposal to suggest that the
>>> macro be named either EOL or NL (to keep it as short as possible), that it
>>> be defined in a Subversion-internal header so that it is not visible to
>>> outside code (as it lacks the SVN_ prefix that would otherwise keep it
from
>>> polluting the namespace), and that the EOL or NL tokens be lined up so
that
>>> they terminate in the 79th column. In the event that a line of text really
>>> cannot be broken up and it is long enough that the EOL or NL token could
>>> not be lined up in this manner with at least 2 characters of separation
>>> from the text, the EOL or NL should be placed wherever the end of that
>>> particular line is with the two spaces of separation.
>>
>> In the hopes of somehow at least partly extricating my foot from my mouth,
>> attached is a revised patch which uses NL instead of SVN_NL, defines this
>> new namespace-less macro in include/private/svn_compat.h (following a brief
>> chat on IRC with C. Michael Pilato) and lines things up so that, as much as
>> possible, they fit nicely into an 80x25 console window. I even reviewed the
>> changes by opening the files in VIM on Windows in a default 80x25 console
>> window. :-)
>>
>> I also thought it would make sense to propose the use of NL over
>> APR_EOL_STR only for multiline string literals, so I reverted the changes
>> in the previous version of the patch which changed APR_EOL_STR where used
>> in other places, such as parameters to functions, newline matching, etc.
>> The patch is a bit smaller, though not a lot since the bulk of the changes
>> still apply and are simply a little bit different.
>>
>> Thoughts? Ready to be applied?
>
>Given that this only affects just 4 source files, and the odd
>namespaceless nature of the new define, I'd personally opt for just
>doing "#define NL APR_EOL_STR" in each file that needs it.
>
>Apart from that, +1.

Okay, well I finally found time to brush the dust off this one and post the
revised patch. I decided to keep the semicolons in the same line, because
the worst that can happen is that an editor will wrap onto the next line,
and that's what the alternative would be anyway. May as well have it on the
same line for those environments that support it. :-)

The NL macros are now defined independently for each of the files which
uses them. I kept the descriptive comment next to the #define so people
will know why it's there.

Should I also prepare a patch to hacking.html to describe this change to
the multi-line string literal policy?

Thanks,

Jonathan Gilbert

(Patch included in-line for review, but probably mangled by my e-mail
client; use the attached GZip to apply the patch.)

Index: subversion/libsvn_subr/config_file.c
===================================================================
--- subversion/libsvn_subr/config_file.c (revision 24705)
+++ subversion/libsvn_subr/config_file.c (working copy)
@@ -33,6 +33,15 @@
 
 #include "svn_private_config.h"
 
+/**
+ * A shorter version of APR_EOL_STR; holds the native linefeed for the
+ * current platform. E.g., on UNIX systems, this will be "\n", while on
+ * Windows, it will be "\r\n". This is defined privately because the
+ * macro lacks a namespacing prefix. Used to terminate lines in large
+ * multi-line string literals.
+ */
+#define NL APR_EOL_STR
+
 
 /* File parsing context */
 typedef struct parse_context_t
@@ -608,222 +617,130 @@
     {
       apr_file_t *f;
       const char *contents =
- "This directory holds run-time configuration information for Subversion"
- APR_EOL_STR
- "clients. The configuration files all share the same syntax, but you"
- APR_EOL_STR
- "should examine a particular file to learn what configuration"
- APR_EOL_STR
- "directives are valid for that file."
- APR_EOL_STR
- APR_EOL_STR
- "The syntax is standard INI format:"
- APR_EOL_STR
- APR_EOL_STR
- " - Empty lines, and lines starting with '#', are ignored."
- APR_EOL_STR
- " The first significant line in a file must be a section header."
- APR_EOL_STR
- APR_EOL_STR
- " - A section starts with a section header, which must start in"
- APR_EOL_STR
- " the first column:"
- APR_EOL_STR
- APR_EOL_STR
- " [section-name]"
- APR_EOL_STR
- APR_EOL_STR
- " - An option, which must always appear within a section, is a pair"
- APR_EOL_STR
- " (name, value). There are two valid forms for defining an"
- APR_EOL_STR
- " option, both of which must start in the first column:"
- APR_EOL_STR
- APR_EOL_STR
- " name: value"
- APR_EOL_STR
- " name = value"
- APR_EOL_STR
- APR_EOL_STR
- " Whitespace around the separator (:, =) is optional."
- APR_EOL_STR
- APR_EOL_STR
- " - Section and option names are case-insensitive, but case is"
- APR_EOL_STR
- " preserved."
- APR_EOL_STR
- APR_EOL_STR
- " - An option's value may be broken into several lines. The value"
- APR_EOL_STR
- " continuation lines must start with at least one whitespace."
- APR_EOL_STR
- " Trailing whitespace in the previous line, the newline character"
- APR_EOL_STR
- " and the leading whitespace in the continuation line is compressed"
- APR_EOL_STR
- " into a single space character."
- APR_EOL_STR
- APR_EOL_STR
- " - All leading and trailing whitespace around a value is trimmed,"
- APR_EOL_STR
- " but the whitespace within a value is preserved, with the"
- APR_EOL_STR
- " exception of whitespace around line continuations, as"
- APR_EOL_STR
- " described above."
- APR_EOL_STR
- APR_EOL_STR
- " - When a value is a boolean, any of the following strings are"
- APR_EOL_STR
- " recognised as truth values (case does not matter):"
- APR_EOL_STR
- APR_EOL_STR
- " true false"
- APR_EOL_STR
- " yes no"
- APR_EOL_STR
- " on off"
- APR_EOL_STR
- " 1 0"
- APR_EOL_STR
- APR_EOL_STR
- " - When a value is a list, it is comma-separated. Again, the"
- APR_EOL_STR
- " whitespace around each element of the list is trimmed."
- APR_EOL_STR
- APR_EOL_STR
- " - Option values may be expanded within a value by enclosing the"
- APR_EOL_STR
- " option name in parentheses, preceded by a percent sign and"
- APR_EOL_STR
- " followed by an 's':"
- APR_EOL_STR
- APR_EOL_STR
- " %(name)s"
- APR_EOL_STR
- APR_EOL_STR
- " The expansion is performed recursively and on demand, during"
- APR_EOL_STR
- " svn_option_get. The name is first searched for in the same"
- APR_EOL_STR
- " section, then in the special [DEFAULT] section. If the name"
- APR_EOL_STR
- " is not found, the whole '%(name)s' placeholder is left"
- APR_EOL_STR
- " unchanged."
- APR_EOL_STR
- APR_EOL_STR
- " Any modifications to the configuration data invalidate all"
- APR_EOL_STR
- " previously expanded values, so that the next svn_option_get"
- APR_EOL_STR
- " will take the modifications into account."
- APR_EOL_STR
- APR_EOL_STR
- "The syntax of the configuration files is a subset of the one used by"
- APR_EOL_STR
- "Python's ConfigParser module; see"
- APR_EOL_STR
- APR_EOL_STR
- " http://www.python.org/doc/current/lib/module-ConfigParser.html"
- APR_EOL_STR
- APR_EOL_STR
- "Configuration data in the Windows registry"
- APR_EOL_STR
- "=========================================="
- APR_EOL_STR
- APR_EOL_STR
- "On Windows, configuration data may also be stored in the registry. The"
- APR_EOL_STR
- "functions svn_config_read and svn_config_merge will read from the"
- APR_EOL_STR
- "registry when passed file names of the form:"
- APR_EOL_STR
- APR_EOL_STR
- " REGISTRY:<hive>/path/to/config-key"
- APR_EOL_STR
- APR_EOL_STR
- "The REGISTRY: prefix must be in upper case. The <hive> part must be"
- APR_EOL_STR
- "one of:"
- APR_EOL_STR
- APR_EOL_STR
- " HKLM for HKEY_LOCAL_MACHINE"
- APR_EOL_STR
- " HKCU for HKEY_CURRENT_USER"
- APR_EOL_STR
- APR_EOL_STR
- "The values in config-key represent the options in the [DEFAULT] section."
- APR_EOL_STR
- "The keys below config-key represent other sections, and their values"
- APR_EOL_STR
- "represent the options. Only values of type REG_SZ whose name doesn't"
- APR_EOL_STR
- "start with a '#' will be used; other values, as well as the keys'"
- APR_EOL_STR
- "default values, will be ignored."
- APR_EOL_STR
- APR_EOL_STR
- APR_EOL_STR
- "File locations"
- APR_EOL_STR
- "=============="
- APR_EOL_STR
- APR_EOL_STR
- "Typically, Subversion uses two config directories, one for site-wide"
- APR_EOL_STR
- "configuration,"
- APR_EOL_STR
- APR_EOL_STR
- " Unix:"
- APR_EOL_STR
- " /etc/subversion/servers"
- APR_EOL_STR
- " /etc/subversion/config"
- APR_EOL_STR
- " /etc/subversion/hairstyles"
- APR_EOL_STR
- " Windows:"
- APR_EOL_STR
- " %ALLUSERSPROFILE%\\Application Data\\Subversion\\servers"
- APR_EOL_STR
- " %ALLUSERSPROFILE%\\Application Data\\Subversion\\config"
- APR_EOL_STR
- " %ALLUSERSPROFILE%\\Application Data\\Subversion\\hairstyles"
- APR_EOL_STR
- " REGISTRY:HKLM\\Software\\Tigris.org\\Subversion\\Servers"
- APR_EOL_STR
- " REGISTRY:HKLM\\Software\\Tigris.org\\Subversion\\Config"
- APR_EOL_STR
- " REGISTRY:HKLM\\Software\\Tigris.org\\Subversion\\Hairstyles"
- APR_EOL_STR
- APR_EOL_STR
- "and one for per-user configuration:"
- APR_EOL_STR
- APR_EOL_STR
- " Unix:"
- APR_EOL_STR
- " ~/.subversion/servers"
- APR_EOL_STR
- " ~/.subversion/config"
- APR_EOL_STR
- " ~/.subversion/hairstyles"
- APR_EOL_STR
- " Windows:"
- APR_EOL_STR
- " %APPDATA%\\Subversion\\servers"
- APR_EOL_STR
- " %APPDATA%\\Subversion\\config"
- APR_EOL_STR
- " %APPDATA%\\Subversion\\hairstyles"
- APR_EOL_STR
- " REGISTRY:HKCU\\Software\\Tigris.org\\Subversion\\Servers"
- APR_EOL_STR
- " REGISTRY:HKCU\\Software\\Tigris.org\\Subversion\\Config"
- APR_EOL_STR
- " REGISTRY:HKCU\\Software\\Tigris.org\\Subversion\\Hairstyles"
- APR_EOL_STR
- APR_EOL_STR;
+ "This directory holds run-time configuration information for
Subversion" NL
+ "clients. The configuration files all share the same syntax, but you"
  NL
+ "should examine a particular file to learn what configuration"
  NL
+ "directives are valid for that file."
  NL
+ ""
  NL
+ "The syntax is standard INI format:"
  NL
+ ""
  NL
+ " - Empty lines, and lines starting with '#', are ignored."
  NL
+ " The first significant line in a file must be a section header."
  NL
+ ""
  NL
+ " - A section starts with a section header, which must start in"
  NL
+ " the first column:"
  NL
+ ""
  NL
+ " [section-name]"
  NL
+ ""
  NL
+ " - An option, which must always appear within a section, is a pair"
  NL
+ " (name, value). There are two valid forms for defining an"
  NL
+ " option, both of which must start in the first column:"
  NL
+ ""
  NL
+ " name: value"
  NL
+ " name = value"
  NL
+ ""
  NL
+ " Whitespace around the separator (:, =) is optional."
  NL
+ ""
  NL
+ " - Section and option names are case-insensitive, but case is"
  NL
+ " preserved."
  NL
+ ""
  NL
+ " - An option's value may be broken into several lines. The value"
  NL
+ " continuation lines must start with at least one whitespace."
  NL
+ " Trailing whitespace in the previous line, the newline character"
  NL
+ " and the leading whitespace in the continuation line is
compressed" NL
+ " into a single space character."
  NL
+ ""
  NL
+ " - All leading and trailing whitespace around a value is trimmed,"
  NL
+ " but the whitespace within a value is preserved, with the"
  NL
+ " exception of whitespace around line continuations, as"
  NL
+ " described above."
  NL
+ ""
  NL
+ " - When a value is a boolean, any of the following strings are"
  NL
+ " recognised as truth values (case does not matter):"
  NL
+ ""
  NL
+ " true false"
  NL
+ " yes no"
  NL
+ " on off"
  NL
+ " 1 0"
  NL
+ ""
  NL
+ " - When a value is a list, it is comma-separated. Again, the"
  NL
+ " whitespace around each element of the list is trimmed."
  NL
+ ""
  NL
+ " - Option values may be expanded within a value by enclosing the"
  NL
+ " option name in parentheses, preceded by a percent sign and"
  NL
+ " followed by an 's':"
  NL
+ ""
  NL
+ " %(name)s"
  NL
+ ""
  NL
+ " The expansion is performed recursively and on demand, during"
  NL
+ " svn_option_get. The name is first searched for in the same"
  NL
+ " section, then in the special [DEFAULT] section. If the name"
  NL
+ " is not found, the whole '%(name)s' placeholder is left"
  NL
+ " unchanged."
  NL
+ ""
  NL
+ " Any modifications to the configuration data invalidate all"
  NL
+ " previously expanded values, so that the next svn_option_get"
  NL
+ " will take the modifications into account."
  NL
+ ""
  NL
+ "The syntax of the configuration files is a subset of the one used by"
  NL
+ "Python's ConfigParser module; see"
  NL
+ ""
  NL
+ " http://www.python.org/doc/current/lib/module-ConfigParser.html"
  NL
+ ""
  NL
+ "Configuration data in the Windows registry"
  NL
+ "=========================================="
  NL
+ ""
  NL
+ "On Windows, configuration data may also be stored in the registry.
The" NL
+ "functions svn_config_read and svn_config_merge will read from the"
  NL
+ "registry when passed file names of the form:"
  NL
+ ""
  NL
+ " REGISTRY:<hive>/path/to/config-key"
  NL
+ ""
  NL
+ "The REGISTRY: prefix must be in upper case. The <hive> part must be"
  NL
+ "one of:"
  NL
+ ""
  NL
+ " HKLM for HKEY_LOCAL_MACHINE"
  NL
+ " HKCU for HKEY_CURRENT_USER"
  NL
+ ""
  NL
+ "The values in config-key represent the options in the [DEFAULT]
section."NL
+ "The keys below config-key represent other sections, and their values"
  NL
+ "represent the options. Only values of type REG_SZ whose name doesn't"
  NL
+ "start with a '#' will be used; other values, as well as the keys'"
  NL
+ "default values, will be ignored."
  NL
+ ""
  NL
+ ""
  NL
+ "File locations"
  NL
+ "=============="
  NL
+ ""
  NL
+ "Typically, Subversion uses two config directories, one for site-wide"
  NL
+ "configuration,"
  NL
+ ""
  NL
+ " Unix:"
  NL
+ " /etc/subversion/servers"
  NL
+ " /etc/subversion/config"
  NL
+ " /etc/subversion/hairstyles"
  NL
+ " Windows:"
  NL
+ " %ALLUSERSPROFILE%\\Application Data\\Subversion\\servers"
  NL
+ " %ALLUSERSPROFILE%\\Application Data\\Subversion\\config"
  NL
+ " %ALLUSERSPROFILE%\\Application Data\\Subversion\\hairstyles"
  NL
+ " REGISTRY:HKLM\\Software\\Tigris.org\\Subversion\\Servers"
  NL
+ " REGISTRY:HKLM\\Software\\Tigris.org\\Subversion\\Config"
  NL
+ " REGISTRY:HKLM\\Software\\Tigris.org\\Subversion\\Hairstyles"
  NL
+ ""
  NL
+ "and one for per-user configuration:"
  NL
+ ""
  NL
+ " Unix:"
  NL
+ " ~/.subversion/servers"
  NL
+ " ~/.subversion/config"
  NL
+ " ~/.subversion/hairstyles"
  NL
+ " Windows:"
  NL
+ " %APPDATA%\\Subversion\\servers"
  NL
+ " %APPDATA%\\Subversion\\config"
  NL
+ " %APPDATA%\\Subversion\\hairstyles"
  NL
+ " REGISTRY:HKCU\\Software\\Tigris.org\\Subversion\\Servers"
  NL
+ " REGISTRY:HKCU\\Software\\Tigris.org\\Subversion\\Config"
  NL
+ " REGISTRY:HKCU\\Software\\Tigris.org\\Subversion\\Hairstyles"
  NL
+ ""
  NL;
 
       err = svn_io_file_open(&f, path,
                              (APR_WRITE | APR_CREATE | APR_EXCL),
@@ -858,166 +775,90 @@
     {
       apr_file_t *f;
       const char *contents =
- "### This file specifies server-specific protocol parameters,"
- APR_EOL_STR
- "### including HTTP proxy information, and HTTP timeout settings."
- APR_EOL_STR
- "###"
- APR_EOL_STR
- "### The currently defined server options are:"
- APR_EOL_STR
- "### http-proxy-host Proxy host for HTTP connection"
- APR_EOL_STR
- "### http-proxy-port Port number of proxy host service"
- APR_EOL_STR
- "### http-proxy-username Username for auth to proxy service"
- APR_EOL_STR
- "### http-proxy-password Password for auth to proxy service"
- APR_EOL_STR
- "### http-proxy-exceptions List of sites that do not use
proxy"
- APR_EOL_STR
- "### http-timeout Timeout for HTTP requests in
seconds"
- APR_EOL_STR
- "### http-compression Whether to compress HTTP requests"
- APR_EOL_STR
- "### neon-debug-mask Debug mask for Neon HTTP library"
- APR_EOL_STR
+ "### This file specifies server-specific protocol parameters,"
  NL
+ "### including HTTP proxy information, and HTTP timeout settings."
  NL
+ "###"
  NL
+ "### The currently defined server options are:"
  NL
+ "### http-proxy-host Proxy host for HTTP connection"
  NL
+ "### http-proxy-port Port number of proxy host
service" NL
+ "### http-proxy-username Username for auth to proxy
service"NL
+ "### http-proxy-password Password for auth to proxy
service"NL
+ "### http-proxy-exceptions List of sites that do not use
proxy" NL
+ "### http-timeout Timeout for HTTP requests in
seconds" NL
+ "### http-compression Whether to compress HTTP
requests" NL
+ "### neon-debug-mask Debug mask for Neon HTTP
library" NL
 #ifdef SVN_NEON_0_26
- "### http-auth-types Auth types to use for HTTP library"
- APR_EOL_STR
+ "### http-auth-types Auth types to use for HTTP
library"NL
 #endif
- "### ssl-authority-files List of files, each of a trusted
CAs"
- APR_EOL_STR
- "### ssl-trust-default-ca Trust the system 'default' CAs"
- APR_EOL_STR
- "### ssl-client-cert-file PKCS#12 format client "
- "certificate file"
- APR_EOL_STR
- "### ssl-client-cert-password Client Key password, if needed."
- APR_EOL_STR
- "###"
- APR_EOL_STR
- "### HTTP timeouts, if given, are specified in seconds. A timeout"
- APR_EOL_STR
- "### of 0, i.e. zero, causes a builtin default to be used."
- APR_EOL_STR
- "###"
- APR_EOL_STR
- "### The commented-out examples below are intended only to"
- APR_EOL_STR
- "### demonstrate how to use this file; any resemblance to actual"
- APR_EOL_STR
- "### servers, living or dead, is entirely coincidental."
- APR_EOL_STR
- APR_EOL_STR
- "### In this section, the URL of the repository you're trying to"
- APR_EOL_STR
- "### access is matched against the patterns on the right. If a"
- APR_EOL_STR
- "### match is found, the server info is from the section with the"
- APR_EOL_STR
- "### corresponding name."
- APR_EOL_STR
- APR_EOL_STR
- "[groups]"
- APR_EOL_STR
- "# group1 = *.collab.net"
- APR_EOL_STR
- "# othergroup = repository.blarggitywhoomph.com"
- APR_EOL_STR
- "# thirdgroup = *.example.com"
- APR_EOL_STR
- APR_EOL_STR
- "### Information for the first group:"
- APR_EOL_STR
- "# [group1]"
- APR_EOL_STR
- "# http-proxy-host = proxy1.some-domain-name.com"
- APR_EOL_STR
- "# http-proxy-port = 80"
- APR_EOL_STR
- "# http-proxy-username = blah"
- APR_EOL_STR
- "# http-proxy-password = doubleblah"
- APR_EOL_STR
- "# http-timeout = 60"
- APR_EOL_STR
+ "### ssl-authority-files List of files, each of a trusted
CAs" NL
+ "### ssl-trust-default-ca Trust the system 'default' CAs"
  NL
+ "### ssl-client-cert-file PKCS#12 format client
certificate file" NL
+ "### ssl-client-cert-password Client Key password, if needed."
  NL
+ "###"
  NL
+ "### HTTP timeouts, if given, are specified in seconds. A
timeout" NL
+ "### of 0, i.e. zero, causes a builtin default to be used."
  NL
+ "###"
  NL
+ "### The commented-out examples below are intended only to"
  NL
+ "### demonstrate how to use this file; any resemblance to actual"
  NL
+ "### servers, living or dead, is entirely coincidental."
  NL
+ ""
  NL
+ "### In this section, the URL of the repository you're trying to"
  NL
+ "### access is matched against the patterns on the right. If a"
  NL
+ "### match is found, the server info is from the section with the"
  NL
+ "### corresponding name."
  NL
+ ""
  NL
+ "[groups]"
  NL
+ "# group1 = *.collab.net"
  NL
+ "# othergroup = repository.blarggitywhoomph.com"
  NL
+ "# thirdgroup = *.example.com"
  NL
+ ""
  NL
+ "### Information for the first group:"
  NL
+ "# [group1]"
  NL
+ "# http-proxy-host = proxy1.some-domain-name.com"
  NL
+ "# http-proxy-port = 80"
  NL
+ "# http-proxy-username = blah"
  NL
+ "# http-proxy-password = doubleblah"
  NL
+ "# http-timeout = 60"
  NL
 #ifdef SVN_NEON_0_26
- "# http-auth-types = basic;digest;negotiate"
- APR_EOL_STR
+ "# http-auth-types = basic;digest;negotiate"
  NL
 #endif
- "# neon-debug-mask = 130"
- APR_EOL_STR
- ""
- APR_EOL_STR
- "### Information for the second group:"
- APR_EOL_STR
- "# [othergroup]"
- APR_EOL_STR
- "# http-proxy-host = proxy2.some-domain-name.com"
- APR_EOL_STR
- "# http-proxy-port = 9000"
- APR_EOL_STR
- "# No username and password, so use the defaults below."
- APR_EOL_STR
- ""
- APR_EOL_STR
- "### You can set default parameters in the 'global' section."
- APR_EOL_STR
- "### These parameters apply if no corresponding parameter is set in"
- APR_EOL_STR
- "### a specifically matched group as shown above. Thus, if you go"
- APR_EOL_STR
- "### through the same proxy server to reach every site on the"
- APR_EOL_STR
- "### Internet, you probably just want to put that server's"
- APR_EOL_STR
- "### information in the 'global' section and not bother with"
- APR_EOL_STR
- "### 'groups' or any other sections."
- APR_EOL_STR
- "###"
- APR_EOL_STR
- "### If you go through a proxy for all but a few sites, you can"
- APR_EOL_STR
- "### list those exceptions under 'http-proxy-exceptions'. This only"
- APR_EOL_STR
- "### overrides defaults, not explicitly matched server names."
- APR_EOL_STR
- "###"
- APR_EOL_STR
- "### 'ssl-authority-files' is a semicolon-delimited list of files,"
- APR_EOL_STR
- "### each pointing to a PEM-encoded Certificate Authority (CA) "
- APR_EOL_STR
- "### SSL certificate. See details above for overriding security "
- APR_EOL_STR
- "### due to SSL."
- APR_EOL_STR
- "[global]"
- APR_EOL_STR
- "# http-proxy-exceptions = *.exception.com, www.internal-site.org"
- APR_EOL_STR
- "# http-proxy-host = defaultproxy.whatever.com"
- APR_EOL_STR
- "# http-proxy-port = 7000"
- APR_EOL_STR
- "# http-proxy-username = defaultusername"
- APR_EOL_STR
- "# http-proxy-password = defaultpassword"
- APR_EOL_STR
- "# http-compression = no"
- APR_EOL_STR
+ "# neon-debug-mask = 130"
  NL
+ ""
  NL
+ "### Information for the second group:"
  NL
+ "# [othergroup]"
  NL
+ "# http-proxy-host = proxy2.some-domain-name.com"
  NL
+ "# http-proxy-port = 9000"
  NL
+ "# No username and password, so use the defaults below."
  NL
+ ""
  NL
+ "### You can set default parameters in the 'global' section."
  NL
+ "### These parameters apply if no corresponding parameter is set
in" NL
+ "### a specifically matched group as shown above. Thus, if you
go" NL
+ "### through the same proxy server to reach every site on the"
  NL
+ "### Internet, you probably just want to put that server's"
  NL
+ "### information in the 'global' section and not bother with"
  NL
+ "### 'groups' or any other sections."
  NL
+ "###"
  NL
+ "### If you go through a proxy for all but a few sites, you can"
  NL
+ "### list those exceptions under 'http-proxy-exceptions'. This
only"NL
+ "### overrides defaults, not explicitly matched server names."
  NL
+ "###"
  NL
+ "### 'ssl-authority-files' is a semicolon-delimited list of
files," NL
+ "### each pointing to a PEM-encoded Certificate Authority (CA) "
  NL
+ "### SSL certificate. See details above for overriding security "
  NL
+ "### due to SSL."
  NL
+ "[global]"
  NL
+ "# http-proxy-exceptions = *.exception.com, www.internal-site.org"
  NL
+ "# http-proxy-host = defaultproxy.whatever.com"
  NL
+ "# http-proxy-port = 7000"
  NL
+ "# http-proxy-username = defaultusername"
  NL
+ "# http-proxy-password = defaultpassword"
  NL
+ "# http-compression = no"
  NL
 #ifdef SVN_NEON_0_26
- "# http-auth-types = basic;digest;negotiate"
- APR_EOL_STR
+ "# http-auth-types = basic;digest;negotiate"
  NL
 #endif
- "# No http-timeout, so just use the builtin default."
- APR_EOL_STR
- "# No neon-debug-mask, so neon debugging is disabled."
- APR_EOL_STR
- "# ssl-authority-files = /path/to/CAcert.pem;/path/to/CAcert2.pem"
- APR_EOL_STR;
+ "# No http-timeout, so just use the builtin default."
  NL
+ "# No neon-debug-mask, so neon debugging is disabled."
  NL
+ "# ssl-authority-files = /path/to/CAcert.pem;/path/to/CAcert2.pem"
  NL;
 
       err = svn_io_file_open(&f, path,
                              (APR_WRITE | APR_CREATE | APR_EXCL),
@@ -1052,212 +893,112 @@
     {
       apr_file_t *f;
       const char *contents =
- "### This file configures various client-side behaviors."
- APR_EOL_STR
- "###"
- APR_EOL_STR
- "### The commented-out examples below are intended to demonstrate"
- APR_EOL_STR
- "### how to use this file."
- APR_EOL_STR
- APR_EOL_STR
- "### Section for authentication and authorization customizations."
- APR_EOL_STR
- "[auth]"
- APR_EOL_STR
- "### Set store-passwords to 'no' to avoid storing passwords in the"
- APR_EOL_STR
- "### auth/ area of your config directory. It defaults to 'yes'."
- APR_EOL_STR
- "### Note that this option only prevents saving of *new* passwords;"
- APR_EOL_STR
- "### it doesn't invalidate existing passwords. (To do that, remove"
- APR_EOL_STR
- "### the cache files by hand as described in the Subversion book.)"
- APR_EOL_STR
- "# store-passwords = no"
- APR_EOL_STR
- "### Set store-auth-creds to 'no' to avoid storing any subversion"
- APR_EOL_STR
- "### credentials in the auth/ area of your config directory."
- APR_EOL_STR
- "### It defaults to 'yes'. Note that this option only prevents"
- APR_EOL_STR
- "### saving of *new* credentials; it doesn't invalidate existing"
- APR_EOL_STR
- "### caches. (To do that, remove the cache files by hand.)"
- APR_EOL_STR
- "# store-auth-creds = no"
- APR_EOL_STR
- APR_EOL_STR
- "### Section for configuring external helper applications."
- APR_EOL_STR
- "[helpers]"
- APR_EOL_STR
- "### Set editor to the command used to invoke your text editor."
- APR_EOL_STR
- "### This will override the environment variables that Subversion"
- APR_EOL_STR
- "### examines by default to find this information ($EDITOR, "
- APR_EOL_STR
- "### et al)."
- APR_EOL_STR
- "# editor-cmd = editor (vi, emacs, notepad, etc.)"
- APR_EOL_STR
- "### Set diff-cmd to the absolute path of your 'diff' program."
- APR_EOL_STR
- "### This will override the compile-time default, which is to use"
- APR_EOL_STR
- "### Subversion's internal diff implementation."
- APR_EOL_STR
- "# diff-cmd = diff_program (diff, gdiff, etc.)"
- APR_EOL_STR
- "### Set diff3-cmd to the absolute path of your 'diff3' program."
- APR_EOL_STR
- "### This will override the compile-time default, which is to use"
- APR_EOL_STR
- "### Subversion's internal diff3 implementation."
- APR_EOL_STR
- "# diff3-cmd = diff3_program (diff3, gdiff3, etc.)"
- APR_EOL_STR
- "### Set diff3-has-program-arg to 'true' or 'yes' if your 'diff3'"
- APR_EOL_STR
- "### program accepts the '--diff-program' option."
- APR_EOL_STR
- "# diff3-has-program-arg = [true | false]"
- APR_EOL_STR
- APR_EOL_STR
- "### Section for configuring tunnel agents."
- APR_EOL_STR
- "[tunnels]"
- APR_EOL_STR
- "### Configure svn protocol tunnel schemes here. By default, only"
- APR_EOL_STR
- "### the 'ssh' scheme is defined. You can define other schemes to"
- APR_EOL_STR
- "### be used with 'svn+scheme://hostname/path' URLs. A scheme"
- APR_EOL_STR
- "### definition is simply a command, optionally prefixed by an"
- APR_EOL_STR
- "### environment variable name which can override the command if it"
- APR_EOL_STR
- "### is defined. The command (or environment variable) may contain"
- APR_EOL_STR
- "### arguments, using standard shell quoting for arguments with"
- APR_EOL_STR
- "### spaces. The command will be invoked as:"
- APR_EOL_STR
- "### <command> <hostname> svnserve -t"
- APR_EOL_STR
- "### (If the URL includes a username, then the hostname will be"
- APR_EOL_STR
- "### passed to the tunnel agent as <user>@<hostname>.) If the"
- APR_EOL_STR
- "### built-in ssh scheme were not predefined, it could be defined"
- APR_EOL_STR
- "### as:"
- APR_EOL_STR
- "# ssh = $SVN_SSH ssh"
- APR_EOL_STR
- "### If you wanted to define a new 'rsh' scheme, to be used with"
- APR_EOL_STR
- "### 'svn+rsh:' URLs, you could do so as follows:"
- APR_EOL_STR
- "# rsh = rsh"
- APR_EOL_STR
- "### Or, if you wanted to specify a full path and arguments:"
- APR_EOL_STR
- "# rsh = /path/to/rsh -l myusername"
- APR_EOL_STR
- "### On Windows, if you are specifying a full path to a command,"
- APR_EOL_STR
- "### use a forward slash (/) or a paired backslash (\\\\) as the"
- APR_EOL_STR
- "### path separator. A single backslash will be treated as an"
- APR_EOL_STR
- "### escape for the following character."
- APR_EOL_STR
- APR_EOL_STR
- "### Section for configuring miscelleneous Subversion options."
- APR_EOL_STR
- "[miscellany]"
- APR_EOL_STR
- "### Set global-ignores to a set of whitespace-delimited globs"
- APR_EOL_STR
- "### which Subversion will ignore in its 'status' output, and"
- APR_EOL_STR
- "### while importing or adding files and directories."
- APR_EOL_STR
- "# global-ignores = " SVN_CONFIG_DEFAULT_GLOBAL_IGNORES ""
- APR_EOL_STR
- "### Set log-encoding to the default encoding for log messages"
- APR_EOL_STR
- "# log-encoding = latin1"
- APR_EOL_STR
- "### Set use-commit-times to make checkout/update/switch/revert"
- APR_EOL_STR
- "### put last-committed timestamps on every file touched."
- APR_EOL_STR
- "# use-commit-times = yes"
- APR_EOL_STR
- "### Set no-unlock to prevent 'svn commit' from automatically"
- APR_EOL_STR
- "### releasing locks on files."
- APR_EOL_STR
- "# no-unlock = yes"
- APR_EOL_STR
- "### Set mime-types-file to a MIME type registry file, used to"
- APR_EOL_STR
- "### provide hints to Subversion's MIME type auto-detection
algorithm."
- APR_EOL_STR
- "# mime-types-file = /path/to/mime.types"
- APR_EOL_STR
- "### Set enable-auto-props to 'yes' to enable automatic properties"
- APR_EOL_STR
- "### for 'svn add' and 'svn import', it defaults to 'no'."
- APR_EOL_STR
- "### Automatic properties are defined in the section 'auto-props'."
- APR_EOL_STR
- "# enable-auto-props = yes"
- APR_EOL_STR
- APR_EOL_STR
- "### Section for configuring automatic properties."
- APR_EOL_STR
- "[auto-props]"
- APR_EOL_STR
- "### The format of the entries is:"
- APR_EOL_STR
- "### file-name-pattern = propname[=value][;propname[=value]...]"
- APR_EOL_STR
- "### The file-name-pattern can contain wildcards (such as '*' and"
- APR_EOL_STR
- "### '?'). All entries which match will be applied to the file."
- APR_EOL_STR
- "### Note that auto-props functionality must be enabled, which"
- APR_EOL_STR
- "### is typically done by setting the 'enable-auto-props' option."
- APR_EOL_STR
- "# *.c = svn:eol-style=native"
- APR_EOL_STR
- "# *.cpp = svn:eol-style=native"
- APR_EOL_STR
- "# *.h = svn:eol-style=native"
- APR_EOL_STR
- "# *.dsp = svn:eol-style=CRLF"
- APR_EOL_STR
- "# *.dsw = svn:eol-style=CRLF"
- APR_EOL_STR
- "# *.sh = svn:eol-style=native;svn:executable"
- APR_EOL_STR
- "# *.txt = svn:eol-style=native"
- APR_EOL_STR
- "# *.png = svn:mime-type=image/png"
- APR_EOL_STR
- "# *.jpg = svn:mime-type=image/jpeg"
- APR_EOL_STR
- "# Makefile = svn:eol-style=native"
- APR_EOL_STR
- APR_EOL_STR;
+ "### This file configures various client-side behaviors."
  NL
+ "###"
  NL
+ "### The commented-out examples below are intended to demonstrate"
  NL
+ "### how to use this file."
  NL
+ ""
  NL
+ "### Section for authentication and authorization customizations."
  NL
+ "[auth]"
  NL
+ "### Set store-passwords to 'no' to avoid storing passwords in
the" NL
+ "### auth/ area of your config directory. It defaults to 'yes'."
  NL
+ "### Note that this option only prevents saving of *new*
passwords;" NL
+ "### it doesn't invalidate existing passwords. (To do that,
remove" NL
+ "### the cache files by hand as described in the Subversion
book.)" NL
+ "# store-passwords = no"
  NL
+ "### Set store-auth-creds to 'no' to avoid storing any subversion"
  NL
+ "### credentials in the auth/ area of your config directory."
  NL
+ "### It defaults to 'yes'. Note that this option only prevents"
  NL
+ "### saving of *new* credentials; it doesn't invalidate existing"
  NL
+ "### caches. (To do that, remove the cache files by hand.)"
  NL
+ "# store-auth-creds = no"
  NL
+ ""
  NL
+ "### Section for configuring external helper applications."
  NL
+ "[helpers]"
  NL
+ "### Set editor to the command used to invoke your text editor."
  NL
+ "### This will override the environment variables that
Subversion" NL
+ "### examines by default to find this information ($EDITOR, "
  NL
+ "### et al)."
  NL
+ "# editor-cmd = editor (vi, emacs, notepad, etc.)"
  NL
+ "### Set diff-cmd to the absolute path of your 'diff' program."
  NL
+ "### This will override the compile-time default, which is to
use" NL
+ "### Subversion's internal diff implementation."
  NL
+ "# diff-cmd = diff_program (diff, gdiff, etc.)"
  NL
+ "### Set diff3-cmd to the absolute path of your 'diff3' program."
  NL
+ "### This will override the compile-time default, which is to
use" NL
+ "### Subversion's internal diff3 implementation."
  NL
+ "# diff3-cmd = diff3_program (diff3, gdiff3, etc.)"
  NL
+ "### Set diff3-has-program-arg to 'true' or 'yes' if your 'diff3'"
  NL
+ "### program accepts the '--diff-program' option."
  NL
+ "# diff3-has-program-arg = [true | false]"
  NL
+ ""
  NL
+ "### Section for configuring tunnel agents."
  NL
+ "[tunnels]"
  NL
+ "### Configure svn protocol tunnel schemes here. By default,
only" NL
+ "### the 'ssh' scheme is defined. You can define other schemes
to" NL
+ "### be used with 'svn+scheme://hostname/path' URLs. A scheme"
  NL
+ "### definition is simply a command, optionally prefixed by an"
  NL
+ "### environment variable name which can override the command if
it" NL
+ "### is defined. The command (or environment variable) may
contain" NL
+ "### arguments, using standard shell quoting for arguments with"
  NL
+ "### spaces. The command will be invoked as:"
  NL
+ "### <command> <hostname> svnserve -t"
  NL
+ "### (If the URL includes a username, then the hostname will be"
  NL
+ "### passed to the tunnel agent as <user>@<hostname>.) If the"
  NL
+ "### built-in ssh scheme were not predefined, it could be defined"
  NL
+ "### as:"
  NL
+ "# ssh = $SVN_SSH ssh"
  NL
+ "### If you wanted to define a new 'rsh' scheme, to be used with"
  NL
+ "### 'svn+rsh:' URLs, you could do so as follows:"
  NL
+ "# rsh = rsh"
  NL
+ "### Or, if you wanted to specify a full path and arguments:"
  NL
+ "# rsh = /path/to/rsh -l myusername"
  NL
+ "### On Windows, if you are specifying a full path to a command,"
  NL
+ "### use a forward slash (/) or a paired backslash (\\\\) as the"
  NL
+ "### path separator. A single backslash will be treated as an"
  NL
+ "### escape for the following character."
  NL
+ ""
  NL
+ "### Section for configuring miscelleneous Subversion options."
  NL
+ "[miscellany]"
  NL
+ "### Set global-ignores to a set of whitespace-delimited globs"
  NL
+ "### which Subversion will ignore in its 'status' output, and"
  NL
+ "### while importing or adding files and directories."
  NL
+ "# global-ignores = " SVN_CONFIG_DEFAULT_GLOBAL_IGNORES ""
  NL
+ "### Set log-encoding to the default encoding for log messages"
  NL
+ "# log-encoding = latin1"
  NL
+ "### Set use-commit-times to make checkout/update/switch/revert"
  NL
+ "### put last-committed timestamps on every file touched."
  NL
+ "# use-commit-times = yes"
  NL
+ "### Set no-unlock to prevent 'svn commit' from automatically"
  NL
+ "### releasing locks on files."
  NL
+ "# no-unlock = yes"
  NL
+ "### Set mime-types-file to a MIME type registry file, used to"
  NL
+ "### provide hints to Subversion's MIME type auto-detection
algorithm." NL
+ "# mime-types-file = /path/to/mime.types"
  NL
+ "### Set enable-auto-props to 'yes' to enable automatic
properties" NL
+ "### for 'svn add' and 'svn import', it defaults to 'no'."
  NL
+ "### Automatic properties are defined in the section
'auto-props'." NL
+ "# enable-auto-props = yes"
  NL
+ ""
  NL
+ "### Section for configuring automatic properties."
  NL
+ "[auto-props]"
  NL
+ "### The format of the entries is:"
  NL
+ "### file-name-pattern = propname[=value][;propname[=value]...]"
  NL
+ "### The file-name-pattern can contain wildcards (such as '*' and"
  NL
+ "### '?'). All entries which match will be applied to the file."
  NL
+ "### Note that auto-props functionality must be enabled, which"
  NL
+ "### is typically done by setting the 'enable-auto-props' option."
  NL
+ "# *.c = svn:eol-style=native"
  NL
+ "# *.cpp = svn:eol-style=native"
  NL
+ "# *.h = svn:eol-style=native"
  NL
+ "# *.dsp = svn:eol-style=CRLF"
  NL
+ "# *.dsw = svn:eol-style=CRLF"
  NL
+ "# *.sh = svn:eol-style=native;svn:executable"
  NL
+ "# *.txt = svn:eol-style=native"
  NL
+ "# *.png = svn:mime-type=image/png"
  NL
+ "# *.jpg = svn:mime-type=image/jpeg"
  NL
+ "# Makefile = svn:eol-style=native"
  NL
+ ""
  NL;
         
       err = svn_io_file_open(&f, path,
                              (APR_WRITE | APR_CREATE | APR_EXCL),
Index: subversion/tests/libsvn_diff/diff-diff3-test.c
===================================================================
--- subversion/tests/libsvn_diff/diff-diff3-test.c (revision 24705)
+++ subversion/tests/libsvn_diff/diff-diff3-test.c (working copy)
@@ -23,6 +23,15 @@
 
 #include "../svn_test.h"
 
+/**
+ * A shorter version of APR_EOL_STR; holds the native linefeed for the
+ * current platform. E.g., on UNIX systems, this will be "\n", while on
+ * Windows, it will be "\r\n". This is defined privately because the
+ * macro lacks a namespacing prefix. Used to terminate lines in large
+ * multi-line string literals.
+ */
+#define NL APR_EOL_STR
+
 /* Random number seed. Yes, it's global, just pretend you can't see it. */
 static apr_uint32_t diff_diff3_seed;
 
@@ -388,9 +397,9 @@
 
                        "",
 
- "--- foo2" APR_EOL_STR
- "+++ bar2" APR_EOL_STR
- "@@ -1,3 +0,0 @@" APR_EOL_STR
+ "--- foo2" NL
+ "+++ bar2" NL
+ "@@ -1,3 +0,0 @@" NL
                        "-Aa\n"
                        "-Bb\n"
                        "-Cc\n",
@@ -403,9 +412,9 @@
                        "Bb\n"
                        "Cc\n",
 
- "--- foo3" APR_EOL_STR
- "+++ bar3" APR_EOL_STR
- "@@ -0,0 +1,3 @@" APR_EOL_STR
+ "--- foo3" NL
+ "+++ bar3" NL
+ "@@ -0,0 +1,3 @@" NL
                        "+Aa\n"
                        "+Bb\n"
                        "+Cc\n",
@@ -433,9 +442,9 @@
                        "Bb\n"
                        "Cc\n",
 
- "--- foo4" APR_EOL_STR
- "+++ bar4" APR_EOL_STR
- "@@ -1 +1,3 @@" APR_EOL_STR
+ "--- foo4" NL
+ "+++ bar4" NL
+ "@@ -1 +1,3 @@" NL
                        " Aa\n"
                        "+Bb\n"
                        "+Cc\n",
@@ -448,9 +457,9 @@
                        "Bb\n"
                        "Cc\n",
 
- "--- foo4b" APR_EOL_STR
- "+++ bar4b" APR_EOL_STR
- "@@ -1 +1,3 @@" APR_EOL_STR
+ "--- foo4b" NL
+ "+++ bar4b" NL
+ "@@ -1 +1,3 @@" NL
                        "+Aa\n"
                        "+Bb\n"
                        " Cc\n",
@@ -464,9 +473,9 @@
                        "Bb\r"
                        "Cc\r",
 
- "--- foo4c" APR_EOL_STR
- "+++ bar4c" APR_EOL_STR
- "@@ -1 +1,3 @@" APR_EOL_STR
+ "--- foo4c" NL
+ "+++ bar4c" NL
+ "@@ -1 +1,3 @@" NL
                        "+Aa\r"
                        "+Bb\r"
                        " Cc\n",
@@ -480,9 +489,9 @@
 
                        "Aa\n",
 
- "--- foo5" APR_EOL_STR
- "+++ bar5" APR_EOL_STR
- "@@ -1,3 +1 @@" APR_EOL_STR
+ "--- foo5" NL
+ "+++ bar5" NL
+ "@@ -1,3 +1 @@" NL
                        " Aa\n"
                        "-Bb\n"
                        "-Cc\n",
@@ -495,9 +504,9 @@
 
                        "Cc\n",
 
- "--- foo5b" APR_EOL_STR
- "+++ bar5b" APR_EOL_STR
- "@@ -1,3 +1 @@" APR_EOL_STR
+ "--- foo5b" NL
+ "+++ bar5b" NL
+ "@@ -1,3 +1 @@" NL
                        "-Aa\n"
                        "-Bb\n"
                        " Cc\n",
@@ -511,9 +520,9 @@
 
                        "Cc\n",
 
- "--- foo5c" APR_EOL_STR
- "+++ bar5c" APR_EOL_STR
- "@@ -1,3 +1 @@" APR_EOL_STR
+ "--- foo5c" NL
+ "+++ bar5c" NL
+ "@@ -1,3 +1 @@" NL
                        "-Aa\r\n"
                        "-Bb\r\n"
                        " Cc\r\n",
@@ -541,9 +550,9 @@
                        "Xx\n"
                        "Cc\n",
 
- "--- foo6b" APR_EOL_STR
- "+++ bar6b" APR_EOL_STR
- "@@ -1,3 +1,3 @@" APR_EOL_STR
+ "--- foo6b" NL
+ "+++ bar6b" NL
+ "@@ -1,3 +1,3 @@" NL
                        " Aa\n"
                        "-Bb\n"
                        "+Xx\n"
@@ -559,9 +568,9 @@
                        "Xx\r\n"
                        "Cc\r\n",
 
- "--- foo6c" APR_EOL_STR
- "+++ bar6c" APR_EOL_STR
- "@@ -1,3 +1,3 @@" APR_EOL_STR
+ "--- foo6c" NL
+ "+++ bar6c" NL
+ "@@ -1,3 +1,3 @@" NL
                        " Aa\r\n"
                        "-Bb\r\n"
                        "+Xx\r\n"
@@ -577,9 +586,9 @@
                        "Xx\r"
                        "Cc\r",
 
- "--- foo6d" APR_EOL_STR
- "+++ bar6d" APR_EOL_STR
- "@@ -1,3 +1,3 @@" APR_EOL_STR
+ "--- foo6d" NL
+ "+++ bar6d" NL
+ "@@ -1,3 +1,3 @@" NL
                        " Aa\r"
                        "-Bb\r"
                        "+Xx\r"
@@ -635,9 +644,9 @@
 
                        "Bb\n",
 
- "--- foo7" APR_EOL_STR
- "+++ bar7" APR_EOL_STR
- "@@ -1 +1 @@" APR_EOL_STR
+ "--- foo7" NL
+ "+++ bar7" NL
+ "@@ -1 +1 @@" NL
                        "-Aa\n"
                        "+Bb\n",
                        NULL, pool));
@@ -649,9 +658,9 @@
                        "Bb\n"
                        "Cc\n",
 
- "--- foo7a" APR_EOL_STR
- "+++ bar7a" APR_EOL_STR
- "@@ -1,2 +1,2 @@" APR_EOL_STR
+ "--- foo7a" NL
+ "+++ bar7a" NL
+ "@@ -1,2 +1,2 @@" NL
                        "-Aa\n"
                        "+Bb\n"
                        " Cc\n",
@@ -664,9 +673,9 @@
                        "Bb\n"
                        "Cc\n",
 
- "--- foo7b" APR_EOL_STR
- "+++ bar7b" APR_EOL_STR
- "@@ -1,2 +1,2 @@" APR_EOL_STR
+ "--- foo7b" NL
+ "+++ bar7b" NL
+ "@@ -1,2 +1,2 @@" NL
                        "-Aa\r"
                        "+Bb\n"
                        " Cc\n",
@@ -680,9 +689,9 @@
                        "Xx\n"
                        "Yy\n",
 
- "--- foo8" APR_EOL_STR
- "+++ bar8" APR_EOL_STR
- "@@ -1,3 +1,2 @@" APR_EOL_STR
+ "--- foo8" NL
+ "+++ bar8" NL
+ "@@ -1,3 +1,2 @@" NL
                        "-Aa\n"
                        "-Bb\n"
                        "-Cc\n"
@@ -697,9 +706,9 @@
 
                        "Bb\n",
 
- "--- foo9" APR_EOL_STR
- "+++ bar9" APR_EOL_STR
- "@@ -1,3 +1 @@" APR_EOL_STR
+ "--- foo9" NL
+ "+++ bar9" NL
+ "@@ -1,3 +1 @@" NL
                        "-Aa\n"
                        " Bb\n"
                        "-Cc\n",
@@ -714,13 +723,13 @@
                        "Xx\n"
                        "Yy\n",
 
- "--- foo10" APR_EOL_STR
- "+++ bar10" APR_EOL_STR
- "@@ -1,3 +1,3 @@" APR_EOL_STR
+ "--- foo10" NL
+ "+++ bar10" NL
+ "@@ -1,3 +1,3 @@" NL
                        " Aa\n"
                        "-Bb\n"
- "-Cc" APR_EOL_STR
- "\\ No newline at end of file" APR_EOL_STR
+ "-Cc" NL
+ "\\ No newline at end of file" NL
                        "+Xx\n"
                        "+Yy\n",
                        NULL, pool));
@@ -734,15 +743,15 @@
                        "Bb\n"
                        "Cc",
 
- "--- foo11" APR_EOL_STR
- "+++ bar11" APR_EOL_STR
- "@@ -1,3 +1,3 @@" APR_EOL_STR
+ "--- foo11" NL
+ "+++ bar11" NL
+ "@@ -1,3 +1,3 @@" NL
                        " Aa\n"
                        "-Xx\n"
                        "-Yy\n"
                        "+Bb\n"
- "+Cc" APR_EOL_STR
- "\\ No newline at end of file" APR_EOL_STR,
+ "+Cc" NL
+ "\\ No newline at end of file" NL,
                        NULL, pool));
 
   SVN_ERR(two_way_diff("foo12", "bar12",
@@ -754,16 +763,16 @@
                        "Bb\n"
                        "Cc",
 
- "--- foo12" APR_EOL_STR
- "+++ bar12" APR_EOL_STR
- "@@ -1,3 +1,3 @@" APR_EOL_STR
+ "--- foo12" NL
+ "+++ bar12" NL
+ "@@ -1,3 +1,3 @@" NL
                        " Aa\n"
                        "-Xx\n"
- "-Yy" APR_EOL_STR
- "\\ No newline at end of file" APR_EOL_STR
+ "-Yy" NL
+ "\\ No newline at end of file" NL
                        "+Bb\n"
- "+Cc" APR_EOL_STR
- "\\ No newline at end of file" APR_EOL_STR,
+ "+Cc" NL
+ "\\ No newline at end of file" NL,
                        NULL, pool));
 
   SVN_ERR(two_way_diff("foo13", "bar13",
@@ -785,14 +794,14 @@
                        "Gg\n"
                        "Yy\n",
 
- "--- foo13" APR_EOL_STR
- "+++ bar13" APR_EOL_STR
- "@@ -1,3 +1,4 @@" APR_EOL_STR
+ "--- foo13" NL
+ "+++ bar13" NL
+ "@@ -1,3 +1,4 @@" NL
                        "+Xx\n"
                        " Aa\n"
                        " Bb\n"
                        " Cc\n"
- "@@ -5,3 +6,4 @@" APR_EOL_STR
+ "@@ -5,3 +6,4 @@" NL
                        " Ee\n"
                        " Ff\n"
                        " Gg\n"
@@ -816,9 +825,9 @@
                        "Gg\n"
                        "Ff\n",
 
- "--- foo14" APR_EOL_STR
- "+++ bar14" APR_EOL_STR
- "@@ -1,7 +1,7 @@" APR_EOL_STR
+ "--- foo14" NL
+ "+++ bar14" NL
+ "@@ -1,7 +1,7 @@" NL
                        "+Bb\n"
                        " Aa\n"
                        "-Bb\n"
@@ -839,9 +848,9 @@
                        "Bb\n"
                        "Cc\n",
 
- "--- foo16" APR_EOL_STR
- "+++ bar16" APR_EOL_STR
- "@@ -1,3 +1,3 @@" APR_EOL_STR
+ "--- foo16" NL
+ "+++ bar16" NL
+ "@@ -1,3 +1,3 @@" NL
                        " Aa\n"
                        "-\n"
                        "+Bb\n"
@@ -882,9 +891,9 @@
                        "Hh\n"
                        "Ii\n",
 
- "--- foo15a" APR_EOL_STR
- "+++ bar15a" APR_EOL_STR
- "@@ -2,7 +2,6 @@" APR_EOL_STR
+ "--- foo15a" NL
+ "+++ bar15a" NL
+ "@@ -2,7 +2,6 @@" NL
                        " Bb\n"
                        " Cc\n"
                        " Dd\n"
@@ -917,9 +926,9 @@
                        "Hh\n"
                        "Ii\n",
 
- "--- foo15b" APR_EOL_STR
- "+++ bar15b" APR_EOL_STR
- "@@ -3,6 +3,8 @@" APR_EOL_STR
+ "--- foo15b" NL
+ "+++ bar15b" NL
+ "@@ -3,6 +3,8 @@" NL
                        " Cc\n"
                        " Dd\n"
                        " Ee\n"
@@ -952,9 +961,9 @@
                        "Hh\n"
                        "Ii\n",
 
- "--- foo15c" APR_EOL_STR
- "+++ bar15c" APR_EOL_STR
- "@@ -2,7 +2,8 @@" APR_EOL_STR
+ "--- foo15c" NL
+ "+++ bar15c" NL
+ "@@ -2,7 +2,8 @@" NL
                        " Bb\n"
                        " Cc\n"
                        " Dd\n"
Index: subversion/tests/libsvn_repos/repos-test.c
===================================================================
--- subversion/tests/libsvn_repos/repos-test.c (revision 24705)
+++ subversion/tests/libsvn_repos/repos-test.c (working copy)
@@ -32,6 +32,14 @@
 
 #include "dir-delta-editor.h"
 
+/**
+ * A shorter version of APR_EOL_STR; holds the native linefeed for the
+ * current platform. E.g., on UNIX systems, this will be "\n", while on
+ * Windows, it will be "\r\n". This is defined privately because the
+ * macro lacks a namespacing prefix. Used to terminate lines in large
+ * multi-line string literals.
+ */
+#define NL APR_EOL_STR
 
 
 
@@ -1229,49 +1237,31 @@
 
   /* The authz rules for the phase 1 tests. */
   contents =
- "[greek:/A]"
- APR_EOL_STR
- "* = r"
- APR_EOL_STR
- "plato = w"
- APR_EOL_STR
- APR_EOL_STR
- "[greek:/iota]"
- APR_EOL_STR
- "* ="
- APR_EOL_STR
- APR_EOL_STR
- "[/A/B/lambda]"
- APR_EOL_STR
- "plato = r"
- APR_EOL_STR
- "* ="
- APR_EOL_STR
- APR_EOL_STR
- "[greek:/A/D]"
- APR_EOL_STR
- "plato = r"
- APR_EOL_STR
- "* = r"
- APR_EOL_STR
- APR_EOL_STR
- "[greek:/A/D/G]"
- APR_EOL_STR
- "plato = r"
- APR_EOL_STR
- "* ="
- APR_EOL_STR
- APR_EOL_STR
- "[greek:/A/B/E/beta]"
- APR_EOL_STR
- "* ="
- APR_EOL_STR
- APR_EOL_STR
- "[/nowhere]"
- APR_EOL_STR
- "nobody = r"
- APR_EOL_STR
- APR_EOL_STR;
+ "[greek:/A]"
  NL
+ "* = r"
  NL
+ "plato = w"
  NL
+ ""
  NL
+ "[greek:/iota]"
  NL
+ "* ="
  NL
+ ""
  NL
+ "[/A/B/lambda]"
  NL
+ "plato = r"
  NL
+ "* ="
  NL
+ ""
  NL
+ "[greek:/A/D]"
  NL
+ "plato = r"
  NL
+ "* = r"
  NL
+ ""
  NL
+ "[greek:/A/D/G]"
  NL
+ "plato = r"
  NL
+ "* ="
  NL
+ ""
  NL
+ "[greek:/A/B/E/beta]"
  NL
+ "* ="
  NL
+ ""
  NL
+ "[/nowhere]"
  NL
+ "nobody = r"
  NL
+ ""
  NL;
 
   /* Load the test authz rules. */
   SVN_ERR(authz_get_handle(&authz_cfg, contents, subpool));
@@ -1309,17 +1299,12 @@
   /* The authz rules for the phase 2 tests, first case (cyclic
      dependency). */
   contents =
- "[groups]"
- APR_EOL_STR
- "slaves = cooks,scribes,@gladiators"
- APR_EOL_STR
- "gladiators = equites,thraces,@slaves"
- APR_EOL_STR
- APR_EOL_STR
- "[greek:/A]"
- APR_EOL_STR
- "@slaves = r"
- APR_EOL_STR;
+ "[groups]"
  NL
+ "slaves = cooks,scribes,@gladiators"
  NL
+ "gladiators = equites,thraces,@slaves"
  NL
+ ""
  NL
+ "[greek:/A]"
  NL
+ "@slaves = r"
  NL;
 
   /* Load the test authz rules and check that group cycles are
      reported. */
@@ -1334,10 +1319,8 @@
   /* The authz rules for the phase 2 tests, second case (missing group
      definition). */
   contents =
- "[greek:/A]"
- APR_EOL_STR
- "@senate = r"
- APR_EOL_STR;
+ "[greek:/A]"
  NL
+ "@senate = r"
  NL;
 
   /* Check that references to undefined groups are reported. */
   err = authz_get_handle(&authz_cfg, contents, subpool);
@@ -1350,15 +1333,11 @@
 
   /* The authz rules for the phase 3 tests */
   contents =
- "[/]"
- APR_EOL_STR
- "* = rw"
- APR_EOL_STR
- APR_EOL_STR
- "[greek:/dir2/secret]"
- APR_EOL_STR
- "* ="
- APR_EOL_STR;
+ "[/]"
  NL
+ "* = rw"
  NL
+ ""
  NL
+ "[greek:/dir2/secret]"
  NL
+ "* ="
  NL;
 
   /* Load the test authz rules. */
   SVN_ERR(authz_get_handle(&authz_cfg, contents, subpool));
@@ -1457,38 +1436,26 @@
 
   /* Load the authz rules for the greek tree. */
   authz_contents =
- APR_EOL_STR
- APR_EOL_STR
- "[/]"
- APR_EOL_STR
- "plato = r"
- APR_EOL_STR
- APR_EOL_STR
- "[/A]"
- APR_EOL_STR
- "plato = rw"
- APR_EOL_STR
- APR_EOL_STR
- "[/A/alpha]"
- APR_EOL_STR
- "plato = "
- APR_EOL_STR
- APR_EOL_STR
- "[/A/C]"
- APR_EOL_STR
- APR_EOL_STR
- "plato = "
- APR_EOL_STR
- APR_EOL_STR
- "[/A/D]"
- APR_EOL_STR
- "plato = rw"
- APR_EOL_STR
- APR_EOL_STR
- "[/A/D/G]"
- APR_EOL_STR
- "plato = r"
- ;
+ ""
  NL
+ ""
  NL
+ "[/]"
  NL
+ "plato = r"
  NL
+ ""
  NL
+ "[/A]"
  NL
+ "plato = rw"
  NL
+ ""
  NL
+ "[/A/alpha]"
  NL
+ "plato = "
  NL
+ ""
  NL
+ "[/A/C]"
  NL
+ ""
  NL
+ "plato = "
  NL
+ ""
  NL
+ "[/A/D]"
  NL
+ "plato = rw"
  NL
+ ""
  NL
+ "[/A/D/G]"
  NL
+ "plato = r"; /* No newline at end of file. */
 
   SVN_ERR(authz_get_handle(&authz_file, authz_contents, subpool));
 
Index: subversion/libsvn_repos/repos.c
===================================================================
--- subversion/libsvn_repos/repos.c (revision 24705)
+++ subversion/libsvn_repos/repos.c (working copy)
@@ -31,6 +31,14 @@
 
 #include "repos.h"
 
+/**
+ * A shorter version of APR_EOL_STR; holds the native linefeed for the
+ * current platform. E.g., on UNIX systems, this will be "\n", while on
+ * Windows, it will be "\r\n". This is defined privately because the
+ * macro lacks a namespacing prefix. Used to terminate lines in large
+ * multi-line string literals.
+ */
+#define NL APR_EOL_STR
 
 
 /* Path accessor functions. */
@@ -181,46 +189,30 @@
 }
 
 static const char * bdb_lock_file_contents =
- "DB lock file, representing locks on the versioned filesystem."
- APR_EOL_STR
- APR_EOL_STR
- "All accessors -- both readers and writers -- of the repository's"
- APR_EOL_STR
- "Berkeley DB environment take out shared locks on this file, and"
- APR_EOL_STR
- "each accessor removes its lock when done. If and when the DB"
- APR_EOL_STR
- "recovery procedure is run, the recovery code takes out an"
- APR_EOL_STR
- "exclusive lock on this file, so we can be sure no one else is"
- APR_EOL_STR
- "using the DB during the recovery."
- APR_EOL_STR
- APR_EOL_STR
- "You should never have to edit or remove this file."
- APR_EOL_STR;
+ "DB lock file, representing locks on the versioned filesystem."
  NL
+ ""
  NL
+ "All accessors -- both readers and writers -- of the repository's"
  NL
+ "Berkeley DB environment take out shared locks on this file, and"
  NL
+ "each accessor removes its lock when done. If and when the DB"
  NL
+ "recovery procedure is run, the recovery code takes out an"
  NL
+ "exclusive lock on this file, so we can be sure no one else is"
  NL
+ "using the DB during the recovery."
  NL
+ ""
  NL
+ "You should never have to edit or remove this file."
  NL;
 
 static const char * bdb_logs_lock_file_contents =
- "DB logs lock file, representing locks on the versioned filesystem logs."
- APR_EOL_STR
- APR_EOL_STR
- "All log manipulators of the repository's Berkeley DB environment"
- APR_EOL_STR
- "take out exclusive locks on this file to ensure that only one"
- APR_EOL_STR
- "accessor manipulates the logs at a time."
- APR_EOL_STR
- APR_EOL_STR
- "You should never have to edit or remove this file."
- APR_EOL_STR;
+ "DB logs lock file, representing locks on the versioned filesystem
logs." NL
+ ""
  NL
+ "All log manipulators of the repository's Berkeley DB environment"
  NL
+ "take out exclusive locks on this file to ensure that only one"
  NL
+ "accessor manipulates the logs at a time."
  NL
+ ""
  NL
+ "You should never have to edit or remove this file."
  NL;
 
 static const char * pre12_compat_unneeded_file_contents =
- "This file is not used by Subversion 1.3.x or later."
- APR_EOL_STR
- "However, its existence is required for compatibility with"
- APR_EOL_STR
- "Subversion 1.2.x or earlier."
- APR_EOL_STR;
+ "This file is not used by Subversion 1.3.x or later."
  NL
+ "However, its existence is required for compatibility with"
  NL
+ "Subversion 1.2.x or earlier."
  NL;
 
 /* Create the DB logs lockfile. */
 static svn_error_t *
@@ -272,29 +264,19 @@
 }
 
 
-#define HOOKS_ENVIRONMENT_TEXT \
- "# The hook program typically does not inherit the environment of" \
- APR_EOL_STR \
- "# its parent process. For example, a common problem is for the" \
- APR_EOL_STR \
- "# PATH environment variable to not be set to its usual value, so" \
- APR_EOL_STR \
- "# that subprograms fail to launch unless invoked via absolute path." \
- APR_EOL_STR \
- "# If you're having unexpected problems with a hook program, the" \
- APR_EOL_STR \
- "# culprit may be unusual (or missing) environment variables." \
- APR_EOL_STR
+#define HOOKS_ENVIRONMENT_TEXT
   \
+ "# The hook program typically does not inherit the environment of"
NL \
+ "# its parent process. For example, a common problem is for the"
NL \
+ "# PATH environment variable to not be set to its usual value, so"
NL \
+ "# that subprograms fail to launch unless invoked via absolute path."
NL \
+ "# If you're having unexpected problems with a hook program, the"
NL \
+ "# culprit may be unusual (or missing) environment variables." NL
 
-#define PREWRITTEN_HOOKS_TEXT \
- "# For more examples and pre-written hooks, see those in" \
- APR_EOL_STR \
- "# the Subversion repository at" \
- APR_EOL_STR \
- "# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and" \
- APR_EOL_STR \
- "# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/" \
- APR_EOL_STR \
+#define PREWRITTEN_HOOKS_TEXT
   \
+ "# For more examples and pre-written hooks, see those in"
NL \
+ "# the Subversion repository at"
NL \
+ "# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and"
NL \
+ "# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/" NL
 
 
 static svn_error_t *
@@ -314,101 +296,58 @@
                              svn_repos_start_commit_hook(repos, pool),
                              SVN_REPOS__HOOK_DESC_EXT);
     
+#define SCRIPT_NAME SVN_REPOS__HOOK_START_COMMIT
+
     contents =
- "#!/bin/sh"
- APR_EOL_STR
- APR_EOL_STR
- "# START-COMMIT HOOK"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# The start-commit hook is invoked before a Subversion txn is created"
- APR_EOL_STR
- "# in the process of doing a commit. Subversion runs this hook"
- APR_EOL_STR
- "# by invoking a program (script, executable, binary, etc.) named"
- APR_EOL_STR
- "# '"
- SVN_REPOS__HOOK_START_COMMIT
- "' (for which this file is a template)"
- APR_EOL_STR
- "# with the following ordered arguments:"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# [1] REPOS-PATH (the path to this repository)"
- APR_EOL_STR
- "# [2] USER (the authenticated user attempting to commit)"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# The default working directory for the invocation is undefined, so"
- APR_EOL_STR
- "# the program should set one explicitly if it cares."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# If the hook program exits with success, the commit continues; but"
- APR_EOL_STR
- "# if it exits with failure (non-zero), the commit is stopped before"
- APR_EOL_STR
- "# a Subversion txn is created, and STDERR is returned to the client."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# On a Unix system, the normal procedure is to have "
- "'"
- SVN_REPOS__HOOK_START_COMMIT
- "'"
- APR_EOL_STR
- "# invoke other programs to do the real work, though it may do the"
- APR_EOL_STR
- "# work itself too."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# Note that"
- " '" SVN_REPOS__HOOK_START_COMMIT "' "
- "must be executable by the user(s) who will"
- APR_EOL_STR
- "# invoke it (typically the user httpd runs as), and that user must"
- APR_EOL_STR
- "# have filesystem-level permission to access the repository."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# On a Windows system, you should name the hook program"
- APR_EOL_STR
- "# '" SVN_REPOS__HOOK_START_COMMIT ".bat' or "
- "'" SVN_REPOS__HOOK_START_COMMIT ".exe',"
- APR_EOL_STR
- "# but the basic idea is the same."
- APR_EOL_STR
- "# "
- APR_EOL_STR
- HOOKS_ENVIRONMENT_TEXT
- "# "
- APR_EOL_STR
- "# Here is an example hook script, for a Unix /bin/sh interpreter."
- APR_EOL_STR
- PREWRITTEN_HOOKS_TEXT
- APR_EOL_STR
- APR_EOL_STR
- "REPOS=\"$1\""
- APR_EOL_STR
- "USER=\"$2\""
- APR_EOL_STR
- APR_EOL_STR
- "commit-allower.pl --repository \"$REPOS\" --user \"$USER\" || exit 1"
- APR_EOL_STR
- "special-auth-check.py --user \"$USER\" --auth-level 3 || exit 1"
- APR_EOL_STR
- APR_EOL_STR
- "# All checks passed, so allow the commit."
- APR_EOL_STR
- "exit 0"
- APR_EOL_STR;
+"#!/bin/sh"
  NL
+""
  NL
+"# START-COMMIT HOOK"
  NL
+"#"
  NL
+"# The start-commit hook is invoked before a Subversion txn is created"
  NL
+"# in the process of doing a commit. Subversion runs this hook"
  NL
+"# by invoking a program (script, executable, binary, etc.) named"
  NL
+"# '"SCRIPT_NAME"' (for which this file is a template)"
  NL
+"# with the following ordered arguments:"
  NL
+"#"
  NL
+"# [1] REPOS-PATH (the path to this repository)"
  NL
+"# [2] USER (the authenticated user attempting to commit)"
  NL
+"#"
  NL
+"# The default working directory for the invocation is undefined, so"
  NL
+"# the program should set one explicitly if it cares."
  NL
+"#"
  NL
+"# If the hook program exits with success, the commit continues; but"
  NL
+"# if it exits with failure (non-zero), the commit is stopped before"
  NL
+"# a Subversion txn is created, and STDERR is returned to the client."
  NL
+"#"
  NL
+"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'"
  NL
+"# invoke other programs to do the real work, though it may do the"
  NL
+"# work itself too."
  NL
+"#"
  NL
+"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will"
  NL
+"# invoke it (typically the user httpd runs as), and that user must"
  NL
+"# have filesystem-level permission to access the repository."
  NL
+"#"
  NL
+"# On a Windows system, you should name the hook program"
  NL
+"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe',"
  NL
+"# but the basic idea is the same."
  NL
+"# "
  NL
+HOOKS_ENVIRONMENT_TEXT
+"# "
  NL
+"# Here is an example hook script, for a Unix /bin/sh interpreter."
  NL
+PREWRITTEN_HOOKS_TEXT
+""
  NL
+""
  NL
+"REPOS=\"$1\""
  NL
+"USER=\"$2\""
  NL
+""
  NL
+"commit-allower.pl --repository \"$REPOS\" --user \"$USER\" || exit 1"
  NL
+"special-auth-check.py --user \"$USER\" --auth-level 3 || exit 1"
  NL
+""
  NL
+"# All checks passed, so allow the commit."
  NL
+"exit 0"
  NL;
 
+#undef SCRIPT_NAME
+
     SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
               _("Creating start-commit hook"));
   } /* end start-commit hook */
@@ -419,132 +358,73 @@
                              svn_repos_pre_commit_hook(repos, pool),
                              SVN_REPOS__HOOK_DESC_EXT);
 
+#define SCRIPT_NAME SVN_REPOS__HOOK_PRE_COMMIT
+
     contents =
- "#!/bin/sh"
- APR_EOL_STR
- APR_EOL_STR
- "# PRE-COMMIT HOOK"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# The pre-commit hook is invoked before a Subversion txn is"
- APR_EOL_STR
- "# committed. Subversion runs this hook by invoking a program"
- APR_EOL_STR
- "# (script, executable, binary, etc.) named "
- "'"
- SVN_REPOS__HOOK_PRE_COMMIT "' (for which"
- APR_EOL_STR
- "# this file is a template), with the following ordered arguments:"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# [1] REPOS-PATH (the path to this repository)"
- APR_EOL_STR
- "# [2] TXN-NAME (the name of the txn about to be committed)"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# The default working directory for the invocation is undefined, so"
- APR_EOL_STR
- "# the program should set one explicitly if it cares."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# If the hook program exits with success, the txn is committed; but"
- APR_EOL_STR
- "# if it exits with failure (non-zero), the txn is aborted, no commit"
- APR_EOL_STR
- "# takes place, and STDERR is returned to the client. The hook"
- APR_EOL_STR
- "# program can use the 'svnlook' utility to help it examine the txn."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# On a Unix system, the normal procedure is to have "
- "'"
- SVN_REPOS__HOOK_PRE_COMMIT
- "'"
- APR_EOL_STR
- "# invoke other programs to do the real work, though it may do the"
- APR_EOL_STR
- "# work itself too."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# *** NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT ***"
- APR_EOL_STR
- "# *** FOR REVISION PROPERTIES (like svn:log or svn:author). ***"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# This is why we recommend using the read-only 'svnlook' utility."
- APR_EOL_STR
- "# In the future, Subversion may enforce the rule that pre-commit"
- APR_EOL_STR
- "# hooks should not modify the versioned data in txns, or else come"
- APR_EOL_STR
- "# up with a mechanism to make it safe to do so (by informing the"
- APR_EOL_STR
- "# committing client of the changes). However, right now neither"
- APR_EOL_STR
- "# mechanism is implemented, so hook writers just have to be
careful."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# Note that"
- " '" SVN_REPOS__HOOK_PRE_COMMIT "' "
- "must be executable by the user(s) who will"
- APR_EOL_STR
- "# invoke it (typically the user httpd runs as), and that user must"
- APR_EOL_STR
- "# have filesystem-level permission to access the repository."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# On a Windows system, you should name the hook program"
- APR_EOL_STR
- "# '" SVN_REPOS__HOOK_PRE_COMMIT ".bat' or "
- "'" SVN_REPOS__HOOK_PRE_COMMIT ".exe',"
- APR_EOL_STR
- "# but the basic idea is the same."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- HOOKS_ENVIRONMENT_TEXT
- "# "
- APR_EOL_STR
- "# Here is an example hook script, for a Unix /bin/sh interpreter."
- APR_EOL_STR
- PREWRITTEN_HOOKS_TEXT
- APR_EOL_STR
- APR_EOL_STR
- "REPOS=\"$1\""
- APR_EOL_STR
- "TXN=\"$2\""
- APR_EOL_STR
- APR_EOL_STR
- "# Make sure that the log message contains some text."
- APR_EOL_STR
- "SVNLOOK=" SVN_BINDIR "/svnlook"
- APR_EOL_STR
- "$SVNLOOK log -t \"$TXN\" \"$REPOS\" | \\"
- APR_EOL_STR
- " grep \"[a-zA-Z0-9]\" > /dev/null || exit 1"
- APR_EOL_STR
- APR_EOL_STR
- "# Check that the author of this commit has the rights to perform"
- APR_EOL_STR
- "# the commit on the files and directories being modified."
- APR_EOL_STR
- "commit-access-control.pl \"$REPOS\" \"$TXN\"
commit-access-control.cfg "
- "|| exit 1"
- APR_EOL_STR
- APR_EOL_STR
- "# All checks passed, so allow the commit."
- APR_EOL_STR
- "exit 0"
- APR_EOL_STR;
+"#!/bin/sh"
  NL
+""
  NL
+"# PRE-COMMIT HOOK"
  NL
+"#"
  NL
+"# The pre-commit hook is invoked before a Subversion txn is"
  NL
+"# committed. Subversion runs this hook by invoking a program"
  NL
+"# (script, executable, binary, etc.) named '"SCRIPT_NAME"' (for which"
  NL
+"# this file is a template), with the following ordered arguments:"
  NL
+"#"
  NL
+"# [1] REPOS-PATH (the path to this repository)"
  NL
+"# [2] TXN-NAME (the name of the txn about to be committed)"
  NL
+"#"
  NL
+"# The default working directory for the invocation is undefined, so"
  NL
+"# the program should set one explicitly if it cares."
  NL
+"#"
  NL
+"# If the hook program exits with success, the txn is committed; but"
  NL
+"# if it exits with failure (non-zero), the txn is aborted, no commit"
  NL
+"# takes place, and STDERR is returned to the client. The hook"
  NL
+"# program can use the 'svnlook' utility to help it examine the txn."
  NL
+"#"
  NL
+"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'"
  NL
+"# invoke other programs to do the real work, though it may do the"
  NL
+"# work itself too."
  NL
+"#"
  NL
+"# *** NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT ***"
  NL
+"# *** FOR REVISION PROPERTIES (like svn:log or svn:author). ***"
  NL
+"#"
  NL
+"# This is why we recommend using the read-only 'svnlook' utility."
  NL
+"# In the future, Subversion may enforce the rule that pre-commit"
  NL
+"# hooks should not modify the versioned data in txns, or else come"
  NL
+"# up with a mechanism to make it safe to do so (by informing the"
  NL
+"# committing client of the changes). However, right now neither"
  NL
+"# mechanism is implemented, so hook writers just have to be careful."
  NL
+"#"
  NL
+"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will"
  NL
+"# invoke it (typically the user httpd runs as), and that user must"
  NL
+"# have filesystem-level permission to access the repository."
  NL
+"#"
  NL
+"# On a Windows system, you should name the hook program"
  NL
+"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe',"
  NL
+"# but the basic idea is the same."
  NL
+"#"
  NL
+HOOKS_ENVIRONMENT_TEXT
+"# "
  NL
+"# Here is an example hook script, for a Unix /bin/sh interpreter."
  NL
+PREWRITTEN_HOOKS_TEXT
  NL
+""
  NL
+"REPOS=\"$1\""
  NL
+"TXN=\"$2\""
  NL
+""
  NL
+"# Make sure that the log message contains some text."
  NL
+"SVNLOOK=" SVN_BINDIR "/svnlook"
  NL
+"$SVNLOOK log -t \"$TXN\" \"$REPOS\" | \\"
  NL
+" grep \"[a-zA-Z0-9]\" > /dev/null || exit 1"
  NL
+""
  NL
+"# Check that the author of this commit has the rights to perform"
  NL
+"# the commit on the files and directories being modified."
  NL
+"commit-access-control.pl \"$REPOS\" \"$TXN\" commit-access-control.cfg ||
exit 1"
+
  NL
+""
  NL
+"# All checks passed, so allow the commit."
  NL
+"exit 0"
  NL;
+
+#undef SCRIPT_NAME
     
     SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
               _("Creating pre-commit hook"));
@@ -557,126 +437,69 @@
                              svn_repos_pre_revprop_change_hook(repos, pool),
                              SVN_REPOS__HOOK_DESC_EXT);
 
+#define SCRIPT_NAME SVN_REPOS__HOOK_PRE_REVPROP_CHANGE
+
     contents =
- "#!/bin/sh"
- APR_EOL_STR
- APR_EOL_STR
- "# PRE-REVPROP-CHANGE HOOK"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# The pre-revprop-change hook is invoked before a revision property"
- APR_EOL_STR
- "# is added, modified or deleted. Subversion runs this hook by
invoking"
- APR_EOL_STR
- "# a program (script, executable, binary, etc.) named '"
- SVN_REPOS__HOOK_PRE_REVPROP_CHANGE "'"
- APR_EOL_STR
- "# (for which this file is a template), with the following ordered"
- APR_EOL_STR
- "# arguments:"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# [1] REPOS-PATH (the path to this repository)"
- APR_EOL_STR
- "# [2] REVISION (the revision being tweaked)"
- APR_EOL_STR
- "# [3] USER (the username of the person tweaking the
property)"
- APR_EOL_STR
- "# [4] PROPNAME (the property being set on the revision)"
- APR_EOL_STR
- "# [5] ACTION (the property is being 'A'dded, 'M'odified, or "
- "'D'eleted)"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# [STDIN] PROPVAL ** the new property value is passed via STDIN."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# If the hook program exits with success, the propchange happens; but"
- APR_EOL_STR
- "# if it exits with failure (non-zero), the propchange doesn't happen."
- APR_EOL_STR
- "# The hook program can use the 'svnlook' utility to examine the "
- APR_EOL_STR
- "# existing value of the revision property."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# WARNING: unlike other hooks, this hook MUST exist for revision"
- APR_EOL_STR
- "# properties to be changed. If the hook does not exist, Subversion "
- APR_EOL_STR
- "# will behave as if the hook were present, but failed. The reason"
- APR_EOL_STR
- "# for this is that revision properties are UNVERSIONED, meaning that"
- APR_EOL_STR
- "# a successful propchange is destructive; the old value is gone"
- APR_EOL_STR
- "# forever. We recommend the hook back up the old value somewhere."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# On a Unix system, the normal procedure is to have "
- "'"
- SVN_REPOS__HOOK_PRE_REVPROP_CHANGE
- "'"
- APR_EOL_STR
- "# invoke other programs to do the real work, though it may do the"
- APR_EOL_STR
- "# work itself too."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# Note that"
- " '" SVN_REPOS__HOOK_PRE_REVPROP_CHANGE "' "
- "must be executable by the user(s) who will"
- APR_EOL_STR
- "# invoke it (typically the user httpd runs as), and that user must"
- APR_EOL_STR
- "# have filesystem-level permission to access the repository."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# On a Windows system, you should name the hook program"
- APR_EOL_STR
- "# '" SVN_REPOS__HOOK_PRE_REVPROP_CHANGE ".bat' or "
- "'" SVN_REPOS__HOOK_PRE_REVPROP_CHANGE ".exe',"
- APR_EOL_STR
- "# but the basic idea is the same."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- HOOKS_ENVIRONMENT_TEXT
- "# "
- APR_EOL_STR
- "# Here is an example hook script, for a Unix /bin/sh interpreter."
- APR_EOL_STR
- PREWRITTEN_HOOKS_TEXT
- APR_EOL_STR
- APR_EOL_STR
- "REPOS=\"$1\""
- APR_EOL_STR
- "REV=\"$2\""
- APR_EOL_STR
- "USER=\"$3\""
- APR_EOL_STR
- "PROPNAME=\"$4\""
- APR_EOL_STR
- "ACTION=\"$5\""
- APR_EOL_STR
- APR_EOL_STR
- "if [ \"$ACTION\" = \"M\" -a \"$PROPNAME\" = \"svn:log\" ]; "
- "then exit 0; fi"
- APR_EOL_STR
- APR_EOL_STR
- "echo \"Changing revision properties other than svn:log is "
- "prohibited\" >&2"
- APR_EOL_STR
- "exit 1"
- APR_EOL_STR;
+"#!/bin/sh"
  NL
+""
  NL
+"# PRE-REVPROP-CHANGE HOOK"
  NL
+"#"
  NL
+"# The pre-revprop-change hook is invoked before a revision property"
  NL
+"# is added, modified or deleted. Subversion runs this hook by invoking"
  NL
+"# a program (script, executable, binary, etc.) named '"SCRIPT_NAME"'"
  NL
+"# (for which this file is a template), with the following ordered"
  NL
+"# arguments:"
  NL
+"#"
  NL
+"# [1] REPOS-PATH (the path to this repository)"
  NL
+"# [2] REVISION (the revision being tweaked)"
  NL
+"# [3] USER (the username of the person tweaking the property)"
  NL
+"# [4] PROPNAME (the property being set on the revision)"
  NL
+"# [5] ACTION (the property is being 'A'dded, 'M'odified, or
'D'eleted)"
+
  NL
+"#"
  NL
+"# [STDIN] PROPVAL ** the new property value is passed via STDIN."
  NL
+"#"
  NL
+"# If the hook program exits with success, the propchange happens; but"
  NL
+"# if it exits with failure (non-zero), the propchange doesn't happen."
  NL
+"# The hook program can use the 'svnlook' utility to examine the "
  NL
+"# existing value of the revision property."
  NL
+"#"
  NL
+"# WARNING: unlike other hooks, this hook MUST exist for revision"
  NL
+"# properties to be changed. If the hook does not exist, Subversion "
  NL
+"# will behave as if the hook were present, but failed. The reason"
  NL
+"# for this is that revision properties are UNVERSIONED, meaning that"
  NL
+"# a successful propchange is destructive; the old value is gone"
  NL
+"# forever. We recommend the hook back up the old value somewhere."
  NL
+"#"
  NL
+"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'"
  NL
+"# invoke other programs to do the real work, though it may do the"
  NL
+"# work itself too."
  NL
+"#"
  NL
+"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will"
  NL
+"# invoke it (typically the user httpd runs as), and that user must"
  NL
+"# have filesystem-level permission to access the repository."
  NL
+"#"
  NL
+"# On a Windows system, you should name the hook program"
  NL
+"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe',"
  NL
+"# but the basic idea is the same."
  NL
+"#"
  NL
+HOOKS_ENVIRONMENT_TEXT
+"# "
  NL
+"# Here is an example hook script, for a Unix /bin/sh interpreter."
  NL
+PREWRITTEN_HOOKS_TEXT
  NL
+""
  NL
+"REPOS=\"$1\""
  NL
+"REV=\"$2\""
  NL
+"USER=\"$3\""
  NL
+"PROPNAME=\"$4\""
  NL
+"ACTION=\"$5\""
  NL
+""
  NL
+"if [ \"$ACTION\" = \"M\" -a \"$PROPNAME\" = \"svn:log\" ]; then exit 0;
fi" NL
+""
  NL
+"echo \"Changing revision properties other than svn:log is prohibited\"
>&2" NL
+"exit 1"
  NL;
+
+#undef SCRIPT_NAME
     
     SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
               _("Creating pre-revprop-change hook"));
@@ -689,134 +512,75 @@
                              svn_repos_pre_lock_hook(repos, pool),
                              SVN_REPOS__HOOK_DESC_EXT);
 
+#define SCRIPT_NAME SVN_REPOS__HOOK_PRE_LOCK
+
     contents =
- "#!/bin/sh"
- APR_EOL_STR
- APR_EOL_STR
- "# PRE-LOCK HOOK"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# The pre-lock hook is invoked before an exclusive lock is"
- APR_EOL_STR
- "# created. Subversion runs this hook by invoking a program "
- APR_EOL_STR
- "# (script, executable, binary, etc.) named "
- "'"
- SVN_REPOS__HOOK_PRE_LOCK "' (for which"
- APR_EOL_STR
- "# this file is a template), with the following ordered arguments:"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# [1] REPOS-PATH (the path to this repository)"
- APR_EOL_STR
- "# [2] PATH (the path in the repository about to be locked)"
- APR_EOL_STR
- "# [3] USER (the user creating the lock)"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# The default working directory for the invocation is undefined, so"
- APR_EOL_STR
- "# the program should set one explicitly if it cares."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# If the hook program exits with success, the lock is created; but"
- APR_EOL_STR
- "# if it exits with failure (non-zero), the lock action is aborted"
- APR_EOL_STR
- "# and STDERR is returned to the client."
- APR_EOL_STR
- APR_EOL_STR
- "# On a Unix system, the normal procedure is to have "
- "'"
- SVN_REPOS__HOOK_PRE_LOCK
- "'"
- APR_EOL_STR
- "# invoke other programs to do the real work, though it may do the"
- APR_EOL_STR
- "# work itself too."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# Note that"
- " '" SVN_REPOS__HOOK_PRE_LOCK "' "
- "must be executable by the user(s) who will"
- APR_EOL_STR
- "# invoke it (typically the user httpd runs as), and that user must"
- APR_EOL_STR
- "# have filesystem-level permission to access the repository."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# On a Windows system, you should name the hook program"
- APR_EOL_STR
- "# '" SVN_REPOS__HOOK_PRE_LOCK ".bat' or "
- "'" SVN_REPOS__HOOK_PRE_LOCK ".exe',"
- APR_EOL_STR
- "# but the basic idea is the same."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# Here is an example hook script, for a Unix /bin/sh interpreter:"
- APR_EOL_STR
- APR_EOL_STR
- "REPOS=\"$1\""
- APR_EOL_STR
- "PATH=\"$2\""
- APR_EOL_STR
- "USER=\"$3\""
- APR_EOL_STR
- APR_EOL_STR
- "# If a lock exists and is owned by a different person, don't allow it"
- APR_EOL_STR
- "# to be stolen (e.g., with 'svn lock --force ...')."
- APR_EOL_STR
- APR_EOL_STR
- "# (Maybe this script could send email to the lock owner?)"
- APR_EOL_STR
- "SVNLOOK=" SVN_BINDIR "/svnlook"
- APR_EOL_STR
- "GREP=/bin/grep"
- APR_EOL_STR
- "SED=/bin/sed"
- APR_EOL_STR
- APR_EOL_STR
- "LOCK_OWNER=`$SVNLOOK lock \"$REPOS\" \"$PATH\" | \\"
- APR_EOL_STR
- " $GREP '^Owner: ' | $SED 's/Owner: //'`"
- APR_EOL_STR
- APR_EOL_STR
- "# If we get no result from svnlook, there's no lock, allow the lock
to"
- APR_EOL_STR
- "# happen:"
- APR_EOL_STR
- "if [ \"$LOCK_OWNER\" = \"\" ]; then"
- APR_EOL_STR
- " exit 0"
- APR_EOL_STR
- "fi"
- APR_EOL_STR
- APR_EOL_STR
- "# If the person locking matches the lock's owner, allow the lock to"
- APR_EOL_STR
- "# happen:"
- APR_EOL_STR
- "if [ \"$LOCK_OWNER\" = \"$USER\" ]; then"
- APR_EOL_STR
- " exit 0"
- APR_EOL_STR
- "fi"
- APR_EOL_STR
- APR_EOL_STR
- "# Otherwise, we've got an owner mismatch, so return failure:"
- APR_EOL_STR
- "echo \"Error: $PATH already locked by ${LOCK_OWNER}.\" 1>&2"
- APR_EOL_STR
- "exit 1"
- APR_EOL_STR;
+"#!/bin/sh"
  NL
+""
  NL
+"# PRE-LOCK HOOK"
  NL
+"#"
  NL
+"# The pre-lock hook is invoked before an exclusive lock is"
  NL
+"# created. Subversion runs this hook by invoking a program "
  NL
+"# (script, executable, binary, etc.) named '"SCRIPT_NAME"' (for which"
  NL
+"# this file is a template), with the following ordered arguments:"
  NL
+"#"
  NL
+"# [1] REPOS-PATH (the path to this repository)"
  NL
+"# [2] PATH (the path in the repository about to be locked)"
  NL
+"# [3] USER (the user creating the lock)"
  NL
+"#"
  NL
+"# The default working directory for the invocation is undefined, so"
  NL
+"# the program should set one explicitly if it cares."
  NL
+"#"
  NL
+"# If the hook program exits with success, the lock is created; but"
  NL
+"# if it exits with failure (non-zero), the lock action is aborted"
  NL
+"# and STDERR is returned to the client."
  NL
+""
  NL
+"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'"
  NL
+"# invoke other programs to do the real work, though it may do the"
  NL
+"# work itself too."
  NL
+"#"
  NL
+"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will"
  NL
+"# invoke it (typically the user httpd runs as), and that user must"
  NL
+"# have filesystem-level permission to access the repository."
  NL
+"#"
  NL
+"# On a Windows system, you should name the hook program"
  NL
+"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe',"
  NL
+"# but the basic idea is the same."
  NL
+"#"
  NL
+"# Here is an example hook script, for a Unix /bin/sh interpreter:"
  NL
+""
  NL
+"REPOS=\"$1\""
  NL
+"PATH=\"$2\""
  NL
+"USER=\"$3\""
  NL
+""
  NL
+"# If a lock exists and is owned by a different person, don't allow it"
  NL
+"# to be stolen (e.g., with 'svn lock --force ...')."
  NL
+""
  NL
+"# (Maybe this script could send email to the lock owner?)"
  NL
+"SVNLOOK=" SVN_BINDIR "/svnlook"
  NL
+"GREP=/bin/grep"
  NL
+"SED=/bin/sed"
  NL
+""
  NL
+"LOCK_OWNER=`$SVNLOOK lock \"$REPOS\" \"$PATH\" | \\"
  NL
+" $GREP '^Owner: ' | $SED 's/Owner: //'`"
  NL
+""
  NL
+"# If we get no result from svnlook, there's no lock, allow the lock to"
  NL
+"# happen:"
  NL
+"if [ \"$LOCK_OWNER\" = \"\" ]; then"
  NL
+" exit 0"
  NL
+"fi"
  NL
+""
  NL
+"# If the person locking matches the lock's owner, allow the lock to"
  NL
+"# happen:"
  NL
+"if [ \"$LOCK_OWNER\" = \"$USER\" ]; then"
  NL
+" exit 0"
  NL
+"fi"
  NL
+""
  NL
+"# Otherwise, we've got an owner mismatch, so return failure:"
  NL
+"echo \"Error: $PATH already locked by ${LOCK_OWNER}.\" 1>&2"
  NL
+"exit 1"
  NL;
+
+#undef SCRIPT_NAME
     
     SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
               "Creating pre-lock hook");
@@ -829,127 +593,71 @@
                              svn_repos_pre_unlock_hook(repos, pool),
                              SVN_REPOS__HOOK_DESC_EXT);
 
+#define SCRIPT_NAME SVN_REPOS__HOOK_PRE_UNLOCK
+
     contents =
- "#!/bin/sh"
- APR_EOL_STR
- APR_EOL_STR
- "# PRE-UNLOCK HOOK"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# The pre-unlock hook is invoked before an exclusive lock is"
- APR_EOL_STR
- "# destroyed. Subversion runs this hook by invoking a program "
- APR_EOL_STR
- "# (script, executable, binary, etc.) named "
- "'"
- SVN_REPOS__HOOK_PRE_UNLOCK "' (for which"
- APR_EOL_STR
- "# this file is a template), with the following ordered arguments:"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# [1] REPOS-PATH (the path to this repository)"
- APR_EOL_STR
- "# [2] PATH (the path in the repository about to be
unlocked)"
- APR_EOL_STR
- "# [3] USER (the user destroying the lock)"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# The default working directory for the invocation is undefined, so"
- APR_EOL_STR
- "# the program should set one explicitly if it cares."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# If the hook program exits with success, the lock is destroyed; but"
- APR_EOL_STR
- "# if it exits with failure (non-zero), the unlock action is aborted"
- APR_EOL_STR
- "# and STDERR is returned to the client."
- APR_EOL_STR
- APR_EOL_STR
- "# On a Unix system, the normal procedure is to have "
- "'"
- SVN_REPOS__HOOK_PRE_UNLOCK
- "'"
- APR_EOL_STR
- "# invoke other programs to do the real work, though it may do the"
- APR_EOL_STR
- "# work itself too."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# Note that"
- " '" SVN_REPOS__HOOK_PRE_UNLOCK "' "
- "must be executable by the user(s) who will"
- APR_EOL_STR
- "# invoke it (typically the user httpd runs as), and that user must"
- APR_EOL_STR
- "# have filesystem-level permission to access the repository."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# On a Windows system, you should name the hook program"
- APR_EOL_STR
- "# '" SVN_REPOS__HOOK_PRE_UNLOCK ".bat' or "
- "'" SVN_REPOS__HOOK_PRE_UNLOCK ".exe',"
- APR_EOL_STR
- "# but the basic idea is the same."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# Here is an example hook script, for a Unix /bin/sh interpreter:"
- APR_EOL_STR
- APR_EOL_STR
- "REPOS=\"$1\""
- APR_EOL_STR
- "PATH=\"$2\""
- APR_EOL_STR
- "USER=\"$3\""
- APR_EOL_STR
- APR_EOL_STR
- "# If a lock is owned by a different person, don't allow it be broken."
- APR_EOL_STR
- "# (Maybe this script could send email to the lock owner?)"
- APR_EOL_STR
- APR_EOL_STR
- "SVNLOOK=" SVN_BINDIR "/svnlook"
- APR_EOL_STR
- "GREP=/bin/grep"
- APR_EOL_STR
- "SED=/bin/sed"
- APR_EOL_STR
- APR_EOL_STR
- "LOCK_OWNER=`$SVNLOOK lock \"$REPOS\" \"$PATH\" | \\"
- APR_EOL_STR
- " $GREP '^Owner: ' | $SED 's/Owner: //'`"
- APR_EOL_STR
- APR_EOL_STR
- "# If we get no result from svnlook, there's no lock, return success:"
- APR_EOL_STR
- "if [ \"$LOCK_OWNER\" = \"\" ]; then"
- APR_EOL_STR
- " exit 0"
- APR_EOL_STR
- "fi"
- APR_EOL_STR
- "# If the person unlocking matches the lock's owner, return success:"
- APR_EOL_STR
- "if [ \"$LOCK_OWNER\" = \"$USER\" ]; then"
- APR_EOL_STR
- " exit 0"
- APR_EOL_STR
- "fi"
- APR_EOL_STR
- APR_EOL_STR
- "# Otherwise, we've got an owner mismatch, so return failure:"
- APR_EOL_STR
- "echo \"Error: $PATH locked by ${LOCK_OWNER}.\" 1>&2"
- APR_EOL_STR
- "exit 1"
- APR_EOL_STR;
+"#!/bin/sh"
  NL
+""
  NL
+"# PRE-UNLOCK HOOK"
  NL
+"#"
  NL
+"# The pre-unlock hook is invoked before an exclusive lock is"
  NL
+"# destroyed. Subversion runs this hook by invoking a program "
  NL
+"# (script, executable, binary, etc.) named '"SCRIPT_NAME"' (for which"
  NL
+"# this file is a template), with the following ordered arguments:"
  NL
+"#"
  NL
+"# [1] REPOS-PATH (the path to this repository)"
  NL
+"# [2] PATH (the path in the repository about to be unlocked)"
  NL
+"# [3] USER (the user destroying the lock)"
  NL
+"#"
  NL
+"# The default working directory for the invocation is undefined, so"
  NL
+"# the program should set one explicitly if it cares."
  NL
+"#"
  NL
+"# If the hook program exits with success, the lock is destroyed; but"
  NL
+"# if it exits with failure (non-zero), the unlock action is aborted"
  NL
+"# and STDERR is returned to the client."
  NL
+""
  NL
+"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'"
  NL
+"# invoke other programs to do the real work, though it may do the"
  NL
+"# work itself too."
  NL
+"#"
  NL
+"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will"
  NL
+"# invoke it (typically the user httpd runs as), and that user must"
  NL
+"# have filesystem-level permission to access the repository."
  NL
+"#"
  NL
+"# On a Windows system, you should name the hook program"
  NL
+"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe',"
  NL
+"# but the basic idea is the same."
  NL
+"#"
  NL
+"# Here is an example hook script, for a Unix /bin/sh interpreter:"
  NL
+""
  NL
+"REPOS=\"$1\""
  NL
+"PATH=\"$2\""
  NL
+"USER=\"$3\""
  NL
+""
  NL
+"# If a lock is owned by a different person, don't allow it be broken."
  NL
+"# (Maybe this script could send email to the lock owner?)"
  NL
+""
  NL
+"SVNLOOK=" SVN_BINDIR "/svnlook"
  NL
+"GREP=/bin/grep"
  NL
+"SED=/bin/sed"
  NL
+""
  NL
+"LOCK_OWNER=`$SVNLOOK lock \"$REPOS\" \"$PATH\" | \\"
  NL
+" $GREP '^Owner: ' | $SED 's/Owner: //'`"
  NL
+""
  NL
+"# If we get no result from svnlook, there's no lock, return success:"
  NL
+"if [ \"$LOCK_OWNER\" = \"\" ]; then"
  NL
+" exit 0"
  NL
+"fi"
  NL
+"# If the person unlocking matches the lock's owner, return success:"
  NL
+"if [ \"$LOCK_OWNER\" = \"$USER\" ]; then"
  NL
+" exit 0"
  NL
+"fi"
  NL
+""
  NL
+"# Otherwise, we've got an owner mismatch, so return failure:"
  NL
+"echo \"Error: $PATH locked by ${LOCK_OWNER}.\" 1>&2"
  NL
+"exit 1"
  NL;
+
+#undef SCRIPT_NAME
     
     SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
               "Creating pre-unlock hook");
@@ -963,96 +671,54 @@
                              svn_repos_post_commit_hook(repos, pool),
                              SVN_REPOS__HOOK_DESC_EXT);
 
+#define SCRIPT_NAME SVN_REPOS__HOOK_POST_COMMIT
+
     contents =
- "#!/bin/sh"
- APR_EOL_STR
- APR_EOL_STR
- "# POST-COMMIT HOOK"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# The post-commit hook is invoked after a commit. Subversion runs"
- APR_EOL_STR
- "# this hook by invoking a program (script, executable, binary, etc.)"
- APR_EOL_STR
- "# named '"
- SVN_REPOS__HOOK_POST_COMMIT
- "' (for which this file is a template) with the "
- APR_EOL_STR
- "# following ordered arguments:"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# [1] REPOS-PATH (the path to this repository)"
- APR_EOL_STR
- "# [2] REV (the number of the revision just committed)"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# The default working directory for the invocation is undefined, so"
- APR_EOL_STR
- "# the program should set one explicitly if it cares."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# Because the commit has already completed and cannot be undone,"
- APR_EOL_STR
- "# the exit code of the hook program is ignored. The hook program"
- APR_EOL_STR
- "# can use the 'svnlook' utility to help it examine the"
- APR_EOL_STR
- "# newly-committed tree."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# On a Unix system, the normal procedure is to have "
- "'"
- SVN_REPOS__HOOK_POST_COMMIT
- "'"
- APR_EOL_STR
- "# invoke other programs to do the real work, though it may do the"
- APR_EOL_STR
- "# work itself too."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# Note that"
- " '" SVN_REPOS__HOOK_POST_COMMIT "' "
- "must be executable by the user(s) who will"
- APR_EOL_STR
- "# invoke it (typically the user httpd runs as), and that user must"
- APR_EOL_STR
- "# have filesystem-level permission to access the repository."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# On a Windows system, you should name the hook program"
- APR_EOL_STR
- "# '" SVN_REPOS__HOOK_POST_COMMIT ".bat' or "
- "'" SVN_REPOS__HOOK_POST_COMMIT ".exe',"
- APR_EOL_STR
- "# but the basic idea is the same."
- APR_EOL_STR
- "# "
- APR_EOL_STR
- HOOKS_ENVIRONMENT_TEXT
- "# "
- APR_EOL_STR
- "# Here is an example hook script, for a Unix /bin/sh interpreter."
- APR_EOL_STR
- PREWRITTEN_HOOKS_TEXT
- APR_EOL_STR
- APR_EOL_STR
- "REPOS=\"$1\""
- APR_EOL_STR
- "REV=\"$2\""
- APR_EOL_STR
- APR_EOL_STR
- "commit-email.pl \"$REPOS\" \"$REV\" commit-watchers@example.org"
- APR_EOL_STR
- "log-commit.py --repository \"$REPOS\" --revision \"$REV\""
- APR_EOL_STR;
+"#!/bin/sh"
  NL
+""
  NL
+"# POST-COMMIT HOOK"
  NL
+"#"
  NL
+"# The post-commit hook is invoked after a commit. Subversion runs"
  NL
+"# this hook by invoking a program (script, executable, binary, etc.)"
  NL
+"# named '"SCRIPT_NAME"' (for which this file is a template) with the "
  NL
+"# following ordered arguments:"
  NL
+"#"
  NL
+"# [1] REPOS-PATH (the path to this repository)"
  NL
+"# [2] REV (the number of the revision just committed)"
  NL
+"#"
  NL
+"# The default working directory for the invocation is undefined, so"
  NL
+"# the program should set one explicitly if it cares."
  NL
+"#"
  NL
+"# Because the commit has already completed and cannot be undone,"
  NL
+"# the exit code of the hook program is ignored. The hook program"
  NL
+"# can use the 'svnlook' utility to help it examine the"
  NL
+"# newly-committed tree."
  NL
+"#"
  NL
+"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'"
  NL
+"# invoke other programs to do the real work, though it may do the"
  NL
+"# work itself too."
  NL
+"#"
  NL
+"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will"
  NL
+"# invoke it (typically the user httpd runs as), and that user must"
  NL
+"# have filesystem-level permission to access the repository."
  NL
+"#"
  NL
+"# On a Windows system, you should name the hook program"
  NL
+"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe',"
  NL
+"# but the basic idea is the same."
  NL
+"# "
  NL
+HOOKS_ENVIRONMENT_TEXT
+"# "
  NL
+"# Here is an example hook script, for a Unix /bin/sh interpreter."
  NL
+PREWRITTEN_HOOKS_TEXT
  NL
+
  NL
+"REPOS=\"$1\""
  NL
+"REV=\"$2\""
  NL
+
  NL
+"commit-email.pl \"$REPOS\" \"$REV\" commit-watchers@example.org"
  NL
+"log-commit.py --repository \"$REPOS\" --revision \"$REV\""
  NL;
 
+#undef SCRIPT_NAME
+
     SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
               _("Creating post-commit hook"));
   } /* end post-commit hook */
@@ -1064,101 +730,56 @@
                              svn_repos_post_lock_hook(repos, pool),
                              SVN_REPOS__HOOK_DESC_EXT);
 
+#define SCRIPT_NAME SVN_REPOS__HOOK_POST_LOCK
+
     contents =
- "#!/bin/sh"
- APR_EOL_STR
- APR_EOL_STR
- "# POST-LOCK HOOK"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# The post-lock hook is run after a path is locked. Subversion runs"
- APR_EOL_STR
- "# this hook by invoking a program (script, executable, binary, etc.)"
- APR_EOL_STR
- "# named '"
- SVN_REPOS__HOOK_POST_LOCK
- "' (for which this file is a template) with the "
- APR_EOL_STR
- "# following ordered arguments:"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# [1] REPOS-PATH (the path to this repository)"
- APR_EOL_STR
- "# [2] USER (the user who created the lock)"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# The paths that were just locked are passed to the hook via STDIN
(as"
- APR_EOL_STR
- "# of Subversion 1.2, only one path is passed per invocation, but the"
- APR_EOL_STR
- "# plan is to pass all locked paths at once, so the hook program"
- APR_EOL_STR
- "# should be written accordingly)."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# The default working directory for the invocation is undefined, so"
- APR_EOL_STR
- "# the program should set one explicitly if it cares."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# Because the lock has already been created and cannot be undone,"
- APR_EOL_STR
- "# the exit code of the hook program is ignored. The hook program"
- APR_EOL_STR
- "# can use the 'svnlook' utility to help it examine the"
- APR_EOL_STR
- "# newly-created lock."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# On a Unix system, the normal procedure is to have "
- "'"
- SVN_REPOS__HOOK_POST_LOCK
- "'"
- APR_EOL_STR
- "# invoke other programs to do the real work, though it may do the"
- APR_EOL_STR
- "# work itself too."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# Note that"
- " '" SVN_REPOS__HOOK_POST_LOCK "' "
- "must be executable by the user(s) who will"
- APR_EOL_STR
- "# invoke it (typically the user httpd runs as), and that user must"
- APR_EOL_STR
- "# have filesystem-level permission to access the repository."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# On a Windows system, you should name the hook program"
- APR_EOL_STR
- "# '" SVN_REPOS__HOOK_POST_LOCK ".bat' or "
- "'" SVN_REPOS__HOOK_POST_LOCK ".exe',"
- APR_EOL_STR
- "# but the basic idea is the same."
- APR_EOL_STR
- "# "
- APR_EOL_STR
- "# Here is an example hook script, for a Unix /bin/sh interpreter:"
- APR_EOL_STR
- APR_EOL_STR
- "REPOS=\"$1\""
- APR_EOL_STR
- "USER=\"$2\""
- APR_EOL_STR
- APR_EOL_STR
- "# Send email to interested parties, let them know a lock was created:"
- APR_EOL_STR
- "mailer.py lock \"$REPOS\" \"$USER\" /path/to/mailer.conf"
- APR_EOL_STR;
+"#!/bin/sh"
  NL
+""
  NL
+"# POST-LOCK HOOK"
  NL
+"#"
  NL
+"# The post-lock hook is run after a path is locked. Subversion runs"
  NL
+"# this hook by invoking a program (script, executable, binary, etc.)"
  NL
+"# named '"SCRIPT_NAME"' (for which this file is a template) with the "
  NL
+"# following ordered arguments:"
  NL
+"#"
  NL
+"# [1] REPOS-PATH (the path to this repository)"
  NL
+"# [2] USER (the user who created the lock)"
  NL
+"#"
  NL
+"# The paths that were just locked are passed to the hook via STDIN (as"
  NL
+"# of Subversion 1.2, only one path is passed per invocation, but the"
  NL
+"# plan is to pass all locked paths at once, so the hook program"
  NL
+"# should be written accordingly)."
  NL
+"#"
  NL
+"# The default working directory for the invocation is undefined, so"
  NL
+"# the program should set one explicitly if it cares."
  NL
+"#"
  NL
+"# Because the lock has already been created and cannot be undone,"
  NL
+"# the exit code of the hook program is ignored. The hook program"
  NL
+"# can use the 'svnlook' utility to help it examine the"
  NL
+"# newly-created lock."
  NL
+"#"
  NL
+"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'"
  NL
+"# invoke other programs to do the real work, though it may do the"
  NL
+"# work itself too."
  NL
+"#"
  NL
+"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will"
  NL
+"# invoke it (typically the user httpd runs as), and that user must"
  NL
+"# have filesystem-level permission to access the repository."
  NL
+"#"
  NL
+"# On a Windows system, you should name the hook program"
  NL
+"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe',"
  NL
+"# but the basic idea is the same."
  NL
+"# "
  NL
+"# Here is an example hook script, for a Unix /bin/sh interpreter:"
  NL
+""
  NL
+"REPOS=\"$1\""
  NL
+"USER=\"$2\""
  NL
+""
  NL
+"# Send email to interested parties, let them know a lock was created:"
  NL
+"mailer.py lock \"$REPOS\" \"$USER\" /path/to/mailer.conf"
  NL;
 
+#undef SCRIPT_NAME
+
     SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
               "Creating post-lock hook");
   } /* end post-lock hook */
@@ -1170,97 +791,54 @@
                              svn_repos_post_unlock_hook(repos, pool),
                              SVN_REPOS__HOOK_DESC_EXT);
 
+#define SCRIPT_NAME SVN_REPOS__HOOK_POST_UNLOCK
+
     contents =
- "#!/bin/sh"
- APR_EOL_STR
- APR_EOL_STR
- "# POST-UNLOCK HOOK"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# The post-unlock hook runs after a path is unlocked. Subversion
runs"
- APR_EOL_STR
- "# this hook by invoking a program (script, executable, binary, etc.)"
- APR_EOL_STR
- "# named '"
- SVN_REPOS__HOOK_POST_UNLOCK
- "' (for which this file is a template) with the "
- APR_EOL_STR
- "# following ordered arguments:"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# [1] REPOS-PATH (the path to this repository)"
- APR_EOL_STR
- "# [2] USER (the user who destroyed the lock)"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# The paths that were just unlocked are passed to the hook via STDIN"
- APR_EOL_STR
- "# (as of Subversion 1.2, only one path is passed per invocation, but"
- APR_EOL_STR
- "# the plan is to pass all unlocked paths at once, so the hook program"
- APR_EOL_STR
- "# should be written accordingly)."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# The default working directory for the invocation is undefined, so"
- APR_EOL_STR
- "# the program should set one explicitly if it cares."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# Because the lock has already been destroyed and cannot be undone,"
- APR_EOL_STR
- "# the exit code of the hook program is ignored."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# On a Unix system, the normal procedure is to have "
- "'"
- SVN_REPOS__HOOK_POST_UNLOCK
- "'"
- APR_EOL_STR
- "# invoke other programs to do the real work, though it may do the"
- APR_EOL_STR
- "# work itself too."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# Note that"
- " '" SVN_REPOS__HOOK_POST_UNLOCK "' "
- "must be executable by the user(s) who will"
- APR_EOL_STR
- "# invoke it (typically the user httpd runs as), and that user must"
- APR_EOL_STR
- "# have filesystem-level permission to access the repository."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# On a Windows system, you should name the hook program"
- APR_EOL_STR
- "# '" SVN_REPOS__HOOK_POST_UNLOCK ".bat' or "
- "'" SVN_REPOS__HOOK_POST_UNLOCK ".exe',"
- APR_EOL_STR
- "# but the basic idea is the same."
- APR_EOL_STR
- "# "
- APR_EOL_STR
- "# Here is an example hook script, for a Unix /bin/sh interpreter:"
- APR_EOL_STR
- APR_EOL_STR
- "REPOS=\"$1\""
- APR_EOL_STR
- "USER=\"$2\""
- APR_EOL_STR
- APR_EOL_STR
- "# Send email to interested parties, let them know a lock was removed:"
- APR_EOL_STR
- "mailer.py unlock \"$REPOS\" \"$USER\" /path/to/mailer.conf"
- APR_EOL_STR;
+"#!/bin/sh"
  NL
+""
  NL
+"# POST-UNLOCK HOOK"
  NL
+"#"
  NL
+"# The post-unlock hook runs after a path is unlocked. Subversion runs"
  NL
+"# this hook by invoking a program (script, executable, binary, etc.)"
  NL
+"# named '"SCRIPT_NAME"' (for which this file is a template) with the "
  NL
+"# following ordered arguments:"
  NL
+"#"
  NL
+"# [1] REPOS-PATH (the path to this repository)"
  NL
+"# [2] USER (the user who destroyed the lock)"
  NL
+"#"
  NL
+"# The paths that were just unlocked are passed to the hook via STDIN"
  NL
+"# (as of Subversion 1.2, only one path is passed per invocation, but"
  NL
+"# the plan is to pass all unlocked paths at once, so the hook program"
  NL
+"# should be written accordingly)."
  NL
+"#"
  NL
+"# The default working directory for the invocation is undefined, so"
  NL
+"# the program should set one explicitly if it cares."
  NL
+"#"
  NL
+"# Because the lock has already been destroyed and cannot be undone,"
  NL
+"# the exit code of the hook program is ignored."
  NL
+"#"
  NL
+"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'"
  NL
+"# invoke other programs to do the real work, though it may do the"
  NL
+"# work itself too."
  NL
+"#"
  NL
+"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will"
  NL
+"# invoke it (typically the user httpd runs as), and that user must"
  NL
+"# have filesystem-level permission to access the repository."
  NL
+"#"
  NL
+"# On a Windows system, you should name the hook program"
  NL
+"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe',"
  NL
+"# but the basic idea is the same."
  NL
+"# "
  NL
+"# Here is an example hook script, for a Unix /bin/sh interpreter:"
  NL
+""
  NL
+"REPOS=\"$1\""
  NL
+"USER=\"$2\""
  NL
+""
  NL
+"# Send email to interested parties, let them know a lock was removed:"
  NL
+"mailer.py unlock \"$REPOS\" \"$USER\" /path/to/mailer.conf"
  NL;
 
+#undef SCRIPT_NAME
+
     SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
               "Creating post-unlock hook");
   } /* end post-unlock hook */
@@ -1272,107 +850,60 @@
                              svn_repos_post_revprop_change_hook(repos, pool),
                              SVN_REPOS__HOOK_DESC_EXT);
 
+#define SCRIPT_NAME SVN_REPOS__HOOK_POST_REVPROP_CHANGE
+
     contents =
- "#!/bin/sh"
- APR_EOL_STR
- APR_EOL_STR
- "# POST-REVPROP-CHANGE HOOK"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# The post-revprop-change hook is invoked after a revision property"
- APR_EOL_STR
- "# has been added, modified or deleted. Subversion runs this hook by"
- APR_EOL_STR
- "# invoking a program (script, executable, binary, etc.) named"
- APR_EOL_STR
- "# '" SVN_REPOS__HOOK_POST_REVPROP_CHANGE
- "' (for which this file is a template), with the"
- APR_EOL_STR
- "# following ordered arguments:"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# [1] REPOS-PATH (the path to this repository)"
- APR_EOL_STR
- "# [2] REV (the revision that was tweaked)"
- APR_EOL_STR
- "# [3] USER (the username of the person tweaking the
property)"
- APR_EOL_STR
- "# [4] PROPNAME (the property that was changed)"
- APR_EOL_STR
- "# [5] ACTION (the property was 'A'dded, 'M'odified, or "
- "'D'eleted)"
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# [STDIN] PROPVAL ** the old property value is passed via STDIN."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# Because the propchange has already completed and cannot be undone,"
- APR_EOL_STR
- "# the exit code of the hook program is ignored. The hook program"
- APR_EOL_STR
- "# can use the 'svnlook' utility to help it examine the"
- APR_EOL_STR
- "# new property value."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# On a Unix system, the normal procedure is to have "
- "'"
- SVN_REPOS__HOOK_POST_REVPROP_CHANGE
- "'"
- APR_EOL_STR
- "# invoke other programs to do the real work, though it may do the"
- APR_EOL_STR
- "# work itself too."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# Note that"
- " '" SVN_REPOS__HOOK_POST_REVPROP_CHANGE "' "
- "must be executable by the user(s) who will"
- APR_EOL_STR
- "# invoke it (typically the user httpd runs as), and that user must"
- APR_EOL_STR
- "# have filesystem-level permission to access the repository."
- APR_EOL_STR
- "#"
- APR_EOL_STR
- "# On a Windows system, you should name the hook program"
- APR_EOL_STR
- "# '" SVN_REPOS__HOOK_POST_REVPROP_CHANGE ".bat' or "
- "'" SVN_REPOS__HOOK_POST_REVPROP_CHANGE ".exe',"
- APR_EOL_STR
- "# but the basic idea is the same."
- APR_EOL_STR
- "# "
- APR_EOL_STR
- HOOKS_ENVIRONMENT_TEXT
- "# "
- APR_EOL_STR
- "# Here is an example hook script, for a Unix /bin/sh interpreter."
- APR_EOL_STR
- PREWRITTEN_HOOKS_TEXT
- APR_EOL_STR
- APR_EOL_STR
- "REPOS=\"$1\""
- APR_EOL_STR
- "REV=\"$2\""
- APR_EOL_STR
- "USER=\"$3\""
- APR_EOL_STR
- "PROPNAME=\"$4\""
- APR_EOL_STR
- "ACTION=\"$5\""
- APR_EOL_STR
- APR_EOL_STR
- "propchange-email.pl \"$REPOS\" \"$REV\" \"$USER\" \"$PROPNAME\" "
- "watchers@example.org"
- APR_EOL_STR;
+"#!/bin/sh"
  NL
+""
  NL
+"# POST-REVPROP-CHANGE HOOK"
  NL
+"#"
  NL
+"# The post-revprop-change hook is invoked after a revision property"
  NL
+"# has been added, modified or deleted. Subversion runs this hook by"
  NL
+"# invoking a program (script, executable, binary, etc.) named"
  NL
+"# '"SCRIPT_NAME"' (for which this file is a template), with the"
  NL
+"# following ordered arguments:"
  NL
+"#"
  NL
+"# [1] REPOS-PATH (the path to this repository)"
  NL
+"# [2] REV (the revision that was tweaked)"
  NL
+"# [3] USER (the username of the person tweaking the property)"
  NL
+"# [4] PROPNAME (the property that was changed)"
  NL
+"# [5] ACTION (the property was 'A'dded, 'M'odified, or
'D'eleted)" NL
+"#"
  NL
+"# [STDIN] PROPVAL ** the old property value is passed via STDIN."
  NL
+"#"
  NL
+"# Because the propchange has already completed and cannot be undone,"
  NL
+"# the exit code of the hook program is ignored. The hook program"
  NL
+"# can use the 'svnlook' utility to help it examine the"
  NL
+"# new property value."
  NL
+"#"
  NL
+"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'"
  NL
+"# invoke other programs to do the real work, though it may do the"
  NL
+"# work itself too."
  NL
+"#"
  NL
+"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will"
  NL
+"# invoke it (typically the user httpd runs as), and that user must"
  NL
+"# have filesystem-level permission to access the repository."
  NL
+"#"
  NL
+"# On a Windows system, you should name the hook program"
  NL
+"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe',"
  NL
+"# but the basic idea is the same."
  NL
+"# "
  NL
+HOOKS_ENVIRONMENT_TEXT
+"# "
  NL
+"# Here is an example hook script, for a Unix /bin/sh interpreter."
  NL
+PREWRITTEN_HOOKS_TEXT
  NL
+""
  NL
+"REPOS=\"$1\""
  NL
+"REV=\"$2\""
  NL
+"USER=\"$3\""
  NL
+"PROPNAME=\"$4\""
  NL
+"ACTION=\"$5\""
  NL
+""
  NL
+"propchange-email.pl \"$REPOS\" \"$REV\" \"$USER\" \"$PROPNAME\" "
+"watchers@example.org"
  NL;
 
+#undef SCRIPT_NAME
+
     SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
               _("Creating post-revprop-change hook"));
   } /* end post-revprop-change hook */
@@ -1389,95 +920,56 @@
   /* Write a default template for svnserve.conf. */
   {
     static const char * const svnserve_conf_contents =
- "### This file controls the configuration of the svnserve daemon, if
you"
- APR_EOL_STR
- "### use it to allow access to this repository. (If you only allow"
- APR_EOL_STR
- "### access through http: and/or file: URLs, then this file is"
- APR_EOL_STR
- "### irrelevant.)"
- APR_EOL_STR
- APR_EOL_STR
- "### Visit http://subversion.tigris.org/ for more information."
- APR_EOL_STR
- APR_EOL_STR
- "[general]"
- APR_EOL_STR
- "### These options control access to the repository for
unauthenticated"
- APR_EOL_STR
- "### and authenticated users. Valid values are \"write\", \"read\","
- APR_EOL_STR
- "### and \"none\". The sample settings below are the defaults."
- APR_EOL_STR
- "# anon-access = read"
- APR_EOL_STR
- "# auth-access = write"
- APR_EOL_STR
- "### The password-db option controls the location of the password"
- APR_EOL_STR
- "### database file. Unless you specify a path starting with a /,"
- APR_EOL_STR
- "### the file's location is relative to the directory containing"
- APR_EOL_STR
- "### this configuration file."
- APR_EOL_STR
+"### This file controls the configuration of the svnserve daemon, if you"
  NL
+"### use it to allow access to this repository. (If you only allow"
  NL
+"### access through http: and/or file: URLs, then this file is"
  NL
+"### irrelevant.)"
  NL
+""
  NL
+"### Visit http://subversion.tigris.org/ for more information."
  NL
+""
  NL
+"[general]"
  NL
+"### These options control access to the repository for unauthenticated"
  NL
+"### and authenticated users. Valid values are \"write\", \"read\","
  NL
+"### and \"none\". The sample settings below are the defaults."
  NL
+"# anon-access = read"
  NL
+"# auth-access = write"
  NL
+"### The password-db option controls the location of the password"
  NL
+"### database file. Unless you specify a path starting with a /,"
  NL
+"### the file's location is relative to the directory containing"
  NL
+"### this configuration file."
  NL
 #ifdef SVN_HAVE_SASL
- "### If use-sasl is set to \"true\" below, this file will NOT be used."
- APR_EOL_STR
+"### If use-sasl is set to \"true\" below, this file will NOT be used."
  NL
 #endif
- "### Uncomment the line below to use the default password file."
- APR_EOL_STR
- "# password-db = passwd"
- APR_EOL_STR
- "### The authz-db option controls the location of the authorization"
- APR_EOL_STR
- "### rules for path-based access control. Unless you specify a path"
- APR_EOL_STR
- "### starting with a /, the file's location is relative to the"
- APR_EOL_STR
- "### directory containing this file. If you don't specify an"
- APR_EOL_STR
- "### authz-db, no path-based access control is done."
- APR_EOL_STR
- "### Uncomment the line below to use the default authorization file."
- APR_EOL_STR
- "# authz-db = " SVN_REPOS__CONF_AUTHZ
- APR_EOL_STR
- "### This option specifies the authentication realm of the repository."
- APR_EOL_STR
- "### If two repositories have the same authentication realm, they
should"
- APR_EOL_STR
- "### have the same password database, and vice versa. The default
realm"
- APR_EOL_STR
- "### is the repository's uuid."
- APR_EOL_STR
- "# realm = My First Repository"
-#ifdef SVN_HAVE_SASL
- APR_EOL_STR
- APR_EOL_STR
- "[sasl]"
- APR_EOL_STR
- "### This option specifies whether you want to use the Cyrus SASL"
- APR_EOL_STR
- "### library for authentication. The default is false."
- APR_EOL_STR
- "# use-sasl = true"
- APR_EOL_STR
- "### These options specify the desired strength of the security layer"
- APR_EOL_STR
- "### that you want SASL to provide. 0 means no encryption, 1 means"
- APR_EOL_STR
- "### integrity-checking only, values larger than 1 are correlated"
- APR_EOL_STR
- "### to the effective key length for encryption (e.g. 128 means
128-bit"
- APR_EOL_STR
- "### encryption). The values below are the defaults."
- APR_EOL_STR
- "# min-encryption = 0"
- APR_EOL_STR
- "# max-encryption = 256"
-#endif
- APR_EOL_STR;
+"### Uncomment the line below to use the default password file."
  NL
+"# password-db = passwd"
  NL
+"### The authz-db option controls the location of the authorization"
  NL
+"### rules for path-based access control. Unless you specify a path"
  NL
+"### starting with a /, the file's location is relative to the the"
  NL
+"### directory containing this file. If you don't specify an"
  NL
+"### authz-db, no path-based access control is done."
  NL
+"### Uncomment the line below to use the default authorization file."
  NL
+"# authz-db = " SVN_REPOS__CONF_AUTHZ
  NL
+"### This option specifies the authentication realm of the repository."
  NL
+"### If two repositories have the same authentication realm, they should"
  NL
+"### have the same password database, and vice versa. The default realm"
  NL
+"### is repository's uuid."
  NL
+#ifndef SVN_HAVE_SASL
+"# realm = My First Repository"
  NL;
+#else
+"# realm = My First Repository"
  NL
+""
  NL
+"[sasl]"
  NL
+"### This option specifies whether you want to use the Cyrus SASL"
  NL
+"### library for authentication. Default is false."
  NL
+"# use-sasl = true"
  NL
+"### These options specify the desired strength of the security layer"
  NL
+"### that you want SASL to provide. 0 means no encryption, 1 means"
  NL
+"### integrity-checking only, values larger than 1 are correlated"
  NL
+"### to the effective key length for encryption (e.g. 128 means 128-bit"
  NL
+"### encryption). The values below are the defaults."
  NL
+"# min-encryption = 0"
  NL
+"# max-encryption = 256"
  NL;
+#endif
     
 
     SVN_ERR_W(svn_io_file_create(svn_repos_svnserve_conf(repos, pool),
                                  svnserve_conf_contents, pool),
@@ -1486,21 +978,14 @@
 
   {
     static const char * const passwd_contents =
- "### This file is an example password file for svnserve."
- APR_EOL_STR
- "### Its format is similar to that of svnserve.conf. As shown in the"
- APR_EOL_STR
- "### example below it contains one section labelled [users]."
- APR_EOL_STR
- "### The name and password for each user follow, one account per line."
- APR_EOL_STR
- APR_EOL_STR
- "[users]"
- APR_EOL_STR
- "# harry = harryssecret"
- APR_EOL_STR
- "# sally = sallyssecret"
- APR_EOL_STR;
+"### This file is an example password file for svnserve."
  NL
+"### Its format is similar to that of svnserve.conf. As shown in the"
  NL
+"### example below it contains one section labelled [users]."
  NL
+"### The name and password for each user follow, one account per line."
  NL
+""
  NL
+"[users]"
  NL
+"# harry = harryssecret"
  NL
+"# sally = sallyssecret"
  NL;
 
     SVN_ERR_W(svn_io_file_create(svn_path_join(repos->conf_path,
                                                SVN_REPOS__CONF_PASSWD,
@@ -1511,66 +996,38 @@
 
   {
     static const char * const authz_contents =
- "### This file is an example authorization file for svnserve."
- APR_EOL_STR
- "### Its format is identical to that of mod_authz_svn authorization"
- APR_EOL_STR
- "### files."
- APR_EOL_STR
- "### As shown below each section defines authorizations for the path
and"
- APR_EOL_STR
- "### (optional) repository specified by the section name."
- APR_EOL_STR
- "### The authorizations follow. An authorization line can refer to:"
- APR_EOL_STR
- "### - a single user,"
- APR_EOL_STR
- "### - a group of users defined in a special [groups] section,"
- APR_EOL_STR
- "### - an alias defined in a special [aliases] section,"
- APR_EOL_STR
- "### - all authenticated users, using the '$authenticated' token,"
- APR_EOL_STR
- "### - only anonymous users, using the '$anonymous' token,"
- APR_EOL_STR
- "### - anyone, using the '*' wildcard."
- APR_EOL_STR
- "###"
- APR_EOL_STR
- "### A match can be inverted by prefixing the rule with '~'. Rules can"
- APR_EOL_STR
- "### grant read ('r') access, read-write ('rw') access, or no access"
- APR_EOL_STR
- "### ('')."
- APR_EOL_STR
- APR_EOL_STR
- "[aliases]"
- APR_EOL_STR
- "# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research
Institute/CN=Joe Average"
- APR_EOL_STR
- APR_EOL_STR
- "[groups]"
- APR_EOL_STR
- "# harry_and_sally = harry,sally"
- APR_EOL_STR
- "# harry_sally_and_joe = harry,sally,&joe"
- APR_EOL_STR
- APR_EOL_STR
- "# [/foo/bar]"
- APR_EOL_STR
- "# harry = rw"
- APR_EOL_STR
- "# &joe = r"
- APR_EOL_STR
- "# * ="
- APR_EOL_STR
- APR_EOL_STR
- "# [repository:/baz/fuz]"
- APR_EOL_STR
- "# @harry_and_sally = rw"
- APR_EOL_STR
- "# * = r"
- APR_EOL_STR;
+"### This file is an example authorization file for svnserve."
  NL
+"### Its format is identical to that of mod_authz_svn authorization"
  NL
+"### files."
  NL
+"### As shown below each section defines authorizations for the path and"
  NL
+"### (optional) repository specified by the section name."
  NL
+"### The authorizations follow. An authorization line can refer to:"
  NL
+"### - a single user,"
  NL
+"### - a group of users defined in a special [groups] section,"
  NL
+"### - an alias defined in a special [aliases] section,"
  NL
+"### - all authenticated users, using the '$authenticated' token,"
  NL
+"### - only anonymous users, using the '$anonymous' token,"
  NL
+"### - anyone, using the '*' wildcard."
  NL
+"###"
  NL
+"### A match can be inverted by prefixing the rule with '~'. Rules can"
  NL
+"### grant read ('r') access, read-write ('rw') access, or no access"
  NL
+"### ('')."
  NL
+""
  NL
+"[aliases]"
  NL
+"# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research
Institute/CN=Joe Average" NL
                 
+""
  NL
+"[groups]"
  NL
+"# harry_and_sally = harry,sally"
  NL
+"# harry_sally_and_joe = harry,sally,&joe"
  NL
+""
  NL
+"# [/foo/bar]"
  NL
+"# harry = rw"
  NL
+"# &joe = r"
  NL
+"# * ="
  NL
+""
  NL
+"# [repository:/baz/fuz]"
  NL
+"# @harry_and_sally = rw"
  NL
+"# * = r"
  NL;
 
     SVN_ERR_W(svn_io_file_create(svn_path_join(repos->conf_path,
                                                SVN_REPOS__CONF_AUTHZ,
@@ -1627,28 +1084,17 @@
   /* Write the top-level README file. */
   {
     const char * const readme_header =
- "This is a Subversion repository; use the 'svnadmin' tool to examine"
- APR_EOL_STR
- "it. Do not add, delete, or modify files here unless you know how"
- APR_EOL_STR
- "to avoid corrupting the repository."
- APR_EOL_STR
- APR_EOL_STR;
+ "This is a Subversion repository; use the 'svnadmin' tool to
examine" NL
+ "it. Do not add, delete, or modify files here unless you know how"
  NL
+ "to avoid corrupting the repository."
  NL
+ ""
  NL;
     const char * const readme_bdb_insert =
- "The directory \""
- SVN_REPOS__DB_DIR
- "\" contains a Berkeley DB environment,"
- APR_EOL_STR
- "you may need to tweak the values in \""
- SVN_REPOS__DB_DIR
- "/DB_CONFIG\" to match the"
- APR_EOL_STR
- "requirements of your site."
- APR_EOL_STR
- APR_EOL_STR;
+ "The directory \"" SVN_REPOS__DB_DIR "\" contains a Berkeley DB
environment." NL
+ "you may need to tweak the values in \"" SVN_REPOS__DB_DIR
"/DB_CONFIG\" to match the" NL
+ "requirements of your site."
  NL
+ ""
  NL;
     const char * const readme_footer =
- "Visit http://subversion.tigris.org/ for more information."
- APR_EOL_STR;
+ "Visit http://subversion.tigris.org/ for more information."
  NL;
     apr_file_t *f;
     apr_size_t written;
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Received on Sun Apr 22 07:26:25 2007

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.