Dear Vincent,

Thanks for your contribution.

The hook script template is created by the svnadmin binary, see the code in 
line 372 in [1] (the link [2] offers a better view but it isn't the 
canonical location). This file is maintained by the Subversion project. 
Would you consider sending your contribution to [email protected]? 
Even better would be if you could offer a complete patch.

Cheers,
Daniel

[1] 
https://svn.apache.org/repos/asf/subversion/trunk/subversion/libsvn_repos/repos.c
[2] 
https://demo-server.visualsvn.com/!/#asf/view/head/subversion/trunk/subversion/libsvn_repos/repos.c?line=372

måndag 16 februari 2026 kl. 12:16:17 UTC+1 skrev Vincent Belaïche:

> Dear TortoiseSVN maintainer,
>
> Thank you for bringing TortoiseSVN and maintaining it. It would be great 
> if when using «  svnadmin create » to create a local repo, a template MSDOS 
> batch file was also created for the hook pre-revprop-change, All the 
> templates are sh scripts. I have not tried to rename .tmpl to .sh and add 
> .sh to PATHEXT + associate .sh to some bash interpreter, and see what 
> happens. Instead I found more convenient to port from sh to cmd.exe. So 
> here is the resulting pre-revprop-change.bat.tmpl file that user can rename 
> pre-revprop-change.bat to use w/o changing their MSWindows environment in 
> order to edit the svn:log property. Please feel free to use it at your 
> convenience.
>
>    Vincent.
>
> ----8<-------8<-------8<- pre-revprop-change.bat.tmpl ----8<-------8<---
> @echo off
> :: PRE-REVPROP-CHANGE HOOK
> ::
> :: The pre-revprop-change hook is invoked before a revision property
> :: is added, modified or deleted.  Subversion runs this hook by invoking
> :: a program (script, executable, binary, etc.) named 'pre-revprop-change'
> :: (for which this file is a template), with the following ordered
> :: arguments:
> ::
> ::   [1] REPOS-PATH   (the path to this repository)
> ::   [2] REV          (the revision being tweaked)
> ::   [3] USER         (the username of the person tweaking the property)
> ::   [4] PROPNAME     (the property being set on the revision)
> ::   [5] ACTION       (the property is being 'A'dded, 'M'odified, or 
> 'D'eleted)
> ::
> ::   [STDIN] PROPVAL  ** the new property value is passed via STDIN.
> ::
> :: If the hook program exits with success, the propchange happens; but
> :: if it exits with failure (non-zero), the propchange doesn't happen.
> :: The hook program can use the 'svnlook' utility to examine the 
> :: existing value of the revision property.
> ::
> :: WARNING: unlike other hooks, this hook MUST exist for revision
> :: properties to be changed.  If the hook does not exist, Subversion 
> :: will behave as if the hook were present, but failed.  The reason
> :: for this is that revision properties are UNVERSIONED, meaning that
> :: a successful propchange is destructive;  the old value is gone
> :: forever.  We recommend the hook back up the old value somewhere.
> ::
> :: The default working directory for the invocation is undefined, so
> :: the program should set one explicitly if it cares.
> ::
> :: On a Unix system, the normal procedure is to have 'pre-revprop-change'
> :: invoke other programs to do the real work, though it may do the
> :: work itself too.
> ::
> :: Note that 'pre-revprop-change' must be executable by the user(s) who 
> will
> :: invoke it (typically the user httpd runs as), and that user must
> :: have filesystem-level permission to access the repository.
> ::
> :: On a Windows system, you should name the hook program
> :: 'pre-revprop-change.bat' or 'pre-revprop-change.exe',
> :: but the basic idea is the same.
> ::
> :: The hook program runs in an empty environment, unless the server is
> :: explicitly configured otherwise.  For example, a common problem is for
> :: the PATH environment variable to not be set to its usual value, so
> :: that subprograms fail to launch unless invoked via absolute path.
> :: If you're having unexpected problems with a hook program, the
> :: culprit may be unusual (or missing) environment variables.
> ::
> :: CAUTION:
> :: For security reasons, you MUST always properly quote arguments when
> :: you use them, as those arguments could contain whitespace or other
> :: problematic characters. Additionally, you should delimit the list
> :: of options with "--" before passing the arguments, so malicious
> :: clients cannot bootleg unexpected options to the commands your
> :: script aims to execute.
> :: For similar reasons, you should also add a trailing @ to URLs which
> :: are passed to SVN commands accepting URLs with peg revisions.
> ::
> :: Here is an example hook script, for a Unix /bin/sh interpreter.
> :: For more examples and pre-written hooks, see those in
> :: the Subversion repository at
> :: http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ 
> and
> :: http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/
>
>
> set "REPOS=%1"
> set "REV=%2"
> set "USER=%3"
> set "PROPNAME=%4"
> set "ACTION=%5"
>
> if "%ACTION%" == "M" ( if "%PROPNAME%" == "svn:log" ( exit /B 0))
>
>
> echo Changing revision properties other than svn:log is prohibited >&2
> exit /B 1
> ----8<-------8<-------8<-------8<-------8<-------8<-------8<-------8<---
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"TortoiseSVN" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/tortoisesvn/027c4f6a-dd98-4dfb-8325-da2675b4e284n%40googlegroups.com.

Reply via email to