I wrote a batch script, which is branching my project for svn
and want to create docs with sphinx
which I then copy into the branched path.
The part where I do this is:
ECHO ##### Creating Docs Branch %VERSION%
cd %~dp0\trunk\Python\MyPackage\docs
call make html
cp -r _build\html %~dp0\branches\%VERSION%\Python\docs\MyPackage
svn add %~dp0\branches\%VERSION%\Python\docs\MyPackage
svn commit %~dp0\branches\%VERSION%\Python\docs\MyPackage -m "Added Docs Branch %VERSION%"
This fails with cp: cannot mkdir "D:/00_Workspace/MyProject/MyPackage//branches/1.1.0/Python/docs/MyPackage": Path could not be found
Apparently there is a second /
added between MyPackage
and branches
Why does this happen?
Here is the full version of the batch
@echo off
set "VERSION=%1"
set "COMMON_VERSION=%2"
if "%VERSION%"=="" set /p VERSION=Enter the version number you want to create the branch for?:
if "%COMMON_VERSION%"=="" set /p COMMON_VERSION=Enter the version number of the common python toolchain you want to use?:
set PACKAGE_NAME=%~dp0
ECHO ##### Updating SVN Repository
svn update
ECHO ##### Creating requirements.txt
cd trunk
call python create_requirements_txt.py %VERSION% %COMMON_VERSION%
svn add requirements.txt
svn commit requirements.txt -m "Updated requirements.txt to version %VERSION%"
cd %~dp0
ECHO ##### Creating Branch for version %VERSION%
for /f "delims=" %%i in ('svn info ^| FINDSTR /R /C:"Relative URL"') do set URL=%%i
set "URL=%URL:*: =%"
for /f "delims=" %%i in ('svn info ^| FINDSTR /R /C:"Repository Root"') do set ROOT=%%i
set "ROOT=%ROOT:*: =%"
set "DEST_URL=%ROOT%%URL:*\trunk=%/branches/%VERSION%"
set "SRC_URL=%ROOT%%URL%/trunk"
ECHO ##### Package: %PACKAGE_NAME%
ECHO ##### Source: %SRC_URL%
ECHO ##### Destination: %DEST_URL%
call svn copy %SRC_URL% %DEST_URL% -m "Branch %PACKAGE_NAME% Version %VERSION%"
ECHO ##### Succesfully created branch %VERSION%
call svn update
ECHO ##### Creating Docs Branch %VERSION%
cd %~dp0\trunk\Python\MyPackage\docs
call make html
cp -r _build\html %~dp0\branches\%VERSION%\Python\docs\MyPackage
svn add %~dp0\branches\%VERSION%\Python\docs\MyPackage
svn commit %~dp0\branches\%VERSION%\Python\docs\MyPackage -m "Added Docs Branch %VERSION%"
pause
exit /b 0
:SVN_ERROR
ECHO ##### SVN Error: Either Source Repo (%SRC_URL%) does not exist or the Tag (%DEST_URL%) already exists!
pause
exit /b 1
%~dp0
contains drive letter plus path from where script is run ended with backslash. changesvn add %~dp0\branches\%VERSION%\Python\docs\MyPackage
withsvn add %~dp0branches\%VERSION%\Python\docs\MyPackage
and all similar paths.