Let us assume a repository with the following structure:

   - /hooks/
      - script.bat    (this is a hook script containing `exit 0`)
      - /branch/           (this is a branch of `/trunk`)
      - file.txt
      - /branches/
      - /test/        (this is a branch of `/trunk` too)
         - file.txt
         - /trunk/
      - file.txt
      
The working copy (WC) is checked out at D:\TEST\wc, but we have a sparse 
checkout 
<https://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-checkout.html#tsvn-dug-checkout-depth>
 
so it looks like this:

   - \hooks\
      - script.bat
   - \trunk\
      - file.txt
   
Then set a property to the root: tsvn:startcommithook = start_commit_hook  
%REPOROOT%/hooks/script.bat  true  show.

Now do the following in the WC:

   - Commit a change to \trunk\file.txt; the hook approve/reject dialog 
   shows the path D:\TEST\wc\hooks\script.bat and the script runs as 
   expected upon approval.
   - Switch the local path \trunk to the directory \branch in the 
   repository.
   - Commit a change to the switched \trunk\file.txt; the hook dialog again 
   shows the path D:\TEST\wc\hooks\script.bat and the script runs normally.
   - Switch the local path \trunk to the directory \branches\test in the 
   repository.
   - Commit a change to the switched \trunk\file.txt; the hook dialog now 
   shows the path D:\TEST\hooks\script.bat (note the *missing wc*), the 
   script *does not run* and an error message appears: The hook script 
   returned an error.  The system cannot find the file specified. (the 
   message is a bit misleading, because the script does actually not run, so 
   it cannot return an error, also because its content is only exit 0).
   
So apparently, different depths in the repository directory hierarchy 
levels of normal (/trunk) and switched paths (/branches/test) seem to 
derogate proper expansion of the placeholder %REPOROOT%.

The behaviour does not change when applying the tsvn:startcommithook 
property recursively.

When I change %REPOROOT% to %REPOROOT+% and commit something to the not 
switched local path \trunk, not even the approve/reject dialog appears, 
which lets me suspect that the hook script is not running at all.


On Monday, June 18, 2018 at 4:26:52 PM UTC+2, (unknown) wrote:
>
> We're having some issues on the Super User Stack Exchange right now with 
> %REPOROOT%. A question was posted on Super User stack exchange 
>
>
> https://superuser.com/questions/1229204/why-cant-i-execute-a-client-side-hook-script-when-committing-a-switched-path?noredirect=1#comment1989124_1229204
>  
>
> Basically trying to run a pre-commit hook script, results in the 
> file/directory not found error. The scripts themselves work fine, but this 
> happens when you try and commit anything...where it should trigger the hook 
> script but fails out with this error. 
>
> Even running exit 0 returns the same result. 
>
> Anyone know what the issue could be? 

-- 
You received this message because you are subscribed to the Google Groups 
"TortoiseSVN" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tortoisesvn/098b30d5-dffc-4a78-916f-9f9e948946a8%40googlegroups.com.
  • Why can't... tortoisesvn+APn2wQfR1CrFbLzUlu0pkCQyQPC5o3do4pHZINYkD-Aob51SI8u8
    • Re: ... Stefan via TortoiseSVN
      • ... Carson Wood via TortoiseSVN
        • ... Stefan via TortoiseSVN
          • ... Carson Wood via TortoiseSVN
            • ... Carson Wood via TortoiseSVN
    • Re: ... tortoisesvn+APn2wQe4DwK8akPR2kwaIqiOzNSYlSoD75Z4id9zbtr4pWRejP1e
      • ... Stefan via TortoiseSVN
        • ... aschipfl via TortoiseSVN
          • ... Stefan via TortoiseSVN

Reply via email to