2

I Implement a python script for the pre-commit hook to detect the commit message, author, changed path then throw exception or error in specifics cases.

I want to set this script pre-commit.py in the VisualSVN server Pre-commit Hook using this command in the Hooks

C:\Users\momo\Desktop\pre-commit.py %1 %2

When I want to commit I got this error Access Denied looks like pre-commit hook doesn't recognize my syntax


enter image description here

0

1 Answer 1

1

Python scripts are not considered as executable files on Windows. You should wrap them around in Windows Batch. For example, a pre-commit hook script can look as follows:

set REPOS-PATH=%1
set TXN-NAME=%2
"C:\Python27\python.exe" "C:\Repositories\MyRepository\hooks\pre-commit.py" %REPOS-PATH% %TXN-NAME%

This Windows Batch script will run Python script located at C:\Repositories\MyRepository\hooks\post-commit.py and will pass the %1 and %2 arguments.

Put this code into your repository's \hooks\pre-commit.bat or \hooks\pre-commit.cmd file manually or via the VisualSVN Server Manager console:

  1. Start the VisualSVN Server Manager console.
  2. Right-click a repository and click Properties.
  3. Click the Hooks tab.
  4. Click the Pre-commit hook and click Edit.
Sign up to request clarification or add additional context in comments.

6 Comments

I still have the same error please have a look in picture
1. The hook editor windows should have the content that you now see in Notepad++. 2. Copy the python script file from your Desktop directory to your repository's hooks directory (e.g. C:\Repositories\MyRepo\hooks) and adjust paths accordingly. 3. Make sure that the VisualSVN Server service account has permissions to all files involved including python.exe.
how can check the VisualSVN Server service account has permissions to all files involved including python.exe?
Use the services.msc or run the sc qc visualsvnserver command to see the name of the service account SERVICE_START_NAME. The account is Network Service, by default. The see the NTFS permissions use the Get-Acl PowerShell cmdlet or Windows File Explorer: ntfs.com/ntfs-permissions-setting.htm
do you know how to list specific directories in the SVN pre-commit? I'm using svn list [repor_path] but this command doesn't work in the pre-commit hook how I deal with it using svnlook command?
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.