TortoiseSVN client-side hooks in project properties (delete cache files)

369 views Asked by At

I have several php-projects under SVN control. I want to delete compiled php-template files after update on the client side; these files are located in ./tmp/smarty/compile folder. So using windows command line I can do this using

del /Q path_to_my_project\tmp\smarty\compile

If I run this command in cmd.exe all files are successfully deleted.

using projects properties tsvn:postupdatehook I should use %REPOROOT% placeholder for project path. so my command becomes:

del /Q %REPOROOT%\tmp\smarty\compile

del is the cmd.exe command, so I need to run cmd.exe first and then run desired command. so finally my hook command looks like:

cmd.exe /c del /Q %REPOROOT%\tmp\smarty\compile

when I run this using Win+R (with reporoot changed to full path) it works fine too.

Then I put this line to SVN properties (I should replace \ slashes to /, overwise SNV returns http-path to repository, not local path), and try to update project. TortoiseSVN asks me if I want to run hook:

cmd.exe /c  del /Q D:\_projects\webCakePHP\.....\tmp\smarty\compile

So here reporoot is successfully translated to correct working copy path. Everything looks fine, but when I run this hook, it successfully deletes files in tmp\smarty\compile but it also deletes all files from working copy dir.

the question is, what am I doing wrong, and how to delete files after update right way.

I've tried to put quotes some ways but it doesn't delete enything at all or says that there is no such directory.

thanks

1

There are 1 answers

0
teran On

as an alternate solution to my question, i've created .bat file in %REPOROOT%/bin folder, which deletes files:

pushd %~dp0..\tmp\smarty\compile
del /Q *
popd

and my hook cmd string is %REPOROOT%/bin/clearCache.bat.

this is not exact answer to my question because it requires bat-file creation and isn't one-line hook.