I wanted to edit a log comment in the repository browser and received an error message that no pre-revprop-change hook exists for the repository. Besides having a scary name, what is a pre-revprop-change hook, and how do I create it?
相关问题
- How can I set the SVN password with Emacs 23.1 bui
- If statements in .htaccess files, to enable passwo
- SVN+SSH checkout over VPN using tortoise SVN, Smar
- Mercurial compared to private branches in SVN
- Using Subversion and SourceSafe at the same time?
相关文章
- Is there a version control system abstraction for
- Intermittent “SVNException: svn: E175002: Connecti
- IntelliJ Subversion Authentication Required Dialog
- TortoiseHG and hgsubversion (Windows): “no module
- Incompatible JavaHl library loaded
- TFS vs. JIRA/Bamboo/SVN [closed]
- converting svn repo to git using reposurgeon
- SVN查看日志超时
For Windows, here's a link to an example batch file that only allows changes to the log message (not other properties):
http://ayria.livejournal.com/33438.html
Basically copy the code below into a text file and name it
pre-revprop-change.bat
and save it in the\hooks
subdirectory for your repository.The name of the hook script is not so scary if you manage decipher it: it's pre revision property change hook. In short, the purpose of
pre-revprop-change
hook script is to control changes of unversioned (revision) properties and to send notifications (e.g. to send an email when revision property is changed).There are 2 types of properties in Subversion:
svn:needs-lock
andsvn:mime-type
) that can be set on files and directories,svn:log
andsvn:date
) that are set on repository revisions.Versioned properties have history and can be manipulated by ordinary users who have Read / Write access to a repository. On the other hand, unversioned properties do not have any history and serve mostly maintenance purpose. For example, if you commit a revision it immediately gets
svn:date
with UTC time of your commit,svn:author
with your username andsvn:log
with your commit log message (if you specified any).As I already specified, the purpose of
pre-revprop-change
hook script is to control changes of revision properties. You don't want everyone who has access to a repository to be able to modify all revision properties, so changing revision properties is forbidden by default. To allow users to change properties, you have to createpre-revprop-change
hook.The simplest hook can contain just one line:
exit 0
. It will allow any authenticated user to change any revision property and it should not be used in real environment. On Windows, you can use batch script or PowerShell-based script to implement some logic withinpre-revprop-change
hook.This PowerShell script allows to change
svn:log
property only and denies empty log messages.This batch script allows only "svnmgr" user to change revision properties:
Basically it's a script that is launched before unversioned property is modified on the repository, so that you can manage more precisely what's happening on your repository.
There are templates in the SVN distrib for different hooks, located in the /hooks subdirectory (*.tmpl that you have to edit and rename depending on your OS, to activate).
For PC users: The .bat extension did not work for me when used on Windows Server maching. I used VisualSvn as Django Reinhardt suggested, and it created a hook with a .cmd extension.
Thanks #patmortech
And I added your code which "only the same user can change his code".
For Linux to allow the edition of a log comment,
pre-revprop-change.tmpl
in thehooks
directory of your repositorypre-revprop-change
www-data
)Edited: (thanks to lindes)
0
for the kind of edits, that you want to allow.