views:

25

answers:

1

Hi Everyone,

I am setting up a SVN server in a windows environment: Whenever a tag is made, the post-commit script export a certain number of information about the tag (like author, comments, dependencies ...).

I also want to attach specific files from the tagged repository. To do so, I have been trying the "svn export" commands. This work fine for a "simulated" tag, but does not work using the svn client (tortoise).

svn export --username foo --password bar svn://localhost/My_SVN_DB/tags/My_Tag/My_File.txt My_Export_Directory

I checked the following:

  • Syntax of the command --> Seems to be ok, it works when calling the post commit and passing test arguments
  • Access rights for My_Export_Directory --> Seems to be ok as the script write also a debug file there

Now I am wondering if the tag structure is already present when executing the post commit script? (I thought it was..?)

Any ideas ?

A: 

Redirecting the standard output & standard error help to find the problem:

svn export --username foo --password bar svn://localhost/My_SVN_DB/tags/My_Tag/My_File.txt My_Export_Directory > tmp.log 2>&1

The problem came from one statement before the export. The DB name was extracted using a for /f loop and overwriting an temporary loop variable ( DBNAME ).

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Extract the DB name
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
setLocal EnableDelayedExpansion
for /f "tokens=4 delims=\" %%a in ("%REPOS%") do (set DBNAME=%%a)
echo !DBNAME!>%TMPFILE%
endlocal
REM Here is the problem
set /p DBNAME=<%TMPFILE%

By modifying the last variable name into DBNAME2:

set /p DBNAME2=<%TMPFILE%

The script was able to work properly.

It is still very unclear to me why this happens since the very same trick (for /f + overwrite) is also used in pre-commit script and there it works properly. Any ideas??

WhiteBeer