[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Subversion pre-commit hook

Posted on 2006-05-02
3
Medium Priority
?
1,476 Views
Last Modified: 2013-12-16
Hi I use TortoiseSVN on Windows and have a running SVN Server without apache just the svn daemon.

I need a pre-commit hook that forces users to make a log entry.
The example file of the pre-commit hook contains code for this but it doesn't work.
When I use the example file for real I cannot commit with or withour log message.

Furthermore I don't get the stdErr that should be passed to the Client.
It just says that the commit has failed but without giving the reason that is printed to stdErr.

Here is the code I'm using right now and which doesn't work in any way.

REPOS="$1"
TXN="$2"

# Make sure that the log message contains some text.
SVNLOOK=/usr/bin/svnlook
$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" > /dev/null || exit 1

# Check that the author of this commit has the rights to perform
# the commit on the files and directories being modified.
commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg || exit 1

# All checks passed, so allow the commit.
exit 0

I need a hook script that
a) works
and
b) passes the stdErr to the client so that the User knows why the commit has failed.
0
Comment
Question by:michi3012
2 Comments
 

Author Comment

by:michi3012
ID: 16584457
Btw. I know that Tortoise offers me to configure an option to prevent the user to commit without a log message.
But I also use AnkhSVN as the Visual Studio Plugin and I wasn't able to find an option for Ankh to behave.....
Maybe there is a possibility in the config file but I couldn't figure it out.
0
 
LVL 15

Accepted Solution

by:
m1tk4 earned 2000 total points
ID: 16586441
I'd start with:

1. Verifying that /usr/bin/svnlook is there
2. Verifying that commit-access-control.pl is there
3. replacing one "exit 1" with "exit 0"  at a time in these two checks and finding out which one actually fails

To echo something to a stderr from this script use

echo "Comment required" >&2

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month18 days, 6 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question