pre-revprop-change

2021-08-31 Thread Philipp Mueller
Hello,

I have a problem with my pre-revprop-change (see attachement). I want to allow 
changes to the log message, but only for the author himself OR a set admin. 
This part makes the problems:
set admin = muellerp
set AUTHOR=
for /f "delims=" %%a in ('svnlook author -r %REV% %REPOS%') do @set AUTHOR=%%a
if /I not '%AUTHOR%'=='%user%' if /I not '%user%'=='%admin%' goto 
ERROR_WRONGUSER
If i just write
if /I not '%AUTHOR%'=='%user%'goto ERROR_WRONGUSER
everything works perfectly fine, but then the admin can´t make changes.
I also have tried just to write
if /I not '%user%'=='%admin%' goto ERROR_WRONGUSER
but then it doesn´t work as it should, it prints out the message within 
ERROR_WRONGUSER. I´ve also tried
if /I not '%user%'=="muellerp" goto ERROR_WRONGUSER
not even this is working, also I´ve checked the output of %user% is exactly the 
same as the name, so actually it shouldn´t jump to the ERROR_WRONGUSER.

Can somebody help me, I´m pretty confused.

Thank you and greetings from Germany
Philipp
@ECHO OFF

set admin = muellerp

set repos=%1
set rev=%2
set user=%3
set propname=%4
set action=%5

::
:: Only allow changes to svn:log. The author, date and other revision
:: properties cannot be changed
::
if /I not '%propname%'=='svn:log' goto ERROR_PROPNAME

::
:: Only allow modifications to svn:log (no addition/overwrite or deletion)
::
if /I not '%action%'=='M' goto ERROR_ACTION

::
:: Only allow user to modify their own log messages
::
set AUTHOR=
for /f "delims=" %%a in ('svnlook author -r %REV% %REPOS%') do @set AUTHOR=%%a

if /I not '%AUTHOR%'=='%user%' goto ERROR_WRONGUSER

::if /I not '%AUTHOR%'=='%user%' if /I not '%user%'=='%admin%' goto 
ERROR_WRONGUSER

::
:: Make sure that the new svn:log message contains some text.
::
set bIsEmpty=true
for /f "tokens=*" %%g in ('find /V ""') do (
 set bIsEmpty=false
)
if '%bIsEmpty%'=='true' goto ERROR_EMPTY

goto :eof

:ERROR_EMPTY
echo Empty svn:log properties are not allowed. >&2
goto ERROR_EXIT

:ERROR_PROPNAME
echo Only changes to svn:log revision properties are allowed. >&2
goto ERROR_EXIT

:ERROR_ACTION
echo Only modifications to svn:log revision properties are allowed. >&2
goto ERROR_EXIT

:ERROR_WRONGUSER
echo You are not allowed to modify other user's log messages. >&2
goto ERROR_EXIT

:ERROR_EXIT
exit /b 1 

SVN hook

2021-08-24 Thread Philipp Mueller
Hello,

I´m new to this topic and I have quite a hard time getting into programming 
hooks for my problem. I need a hook which can distinguish between three 
different user groups:

Group A: can do anything (delete tags and trunks, commit without comment)

Group B: can commit to tags and delete tags/branches; CANNOT delete trunks and 
CANNOT commit without comment

Group C: can commit to tags; CANNOT change or delete anything

Is there any way to do that?


I am very grateful for you help !

Greetings

Philipp from Germany