0

I need to update multiple SVN working copies. I want to write this to a log file, but it isn't possible, because one SVN update takes only a few seconds and a different one maybe up to minutes.

Due of that, I'm always getting the following message:

The process cannot access the file because it is being used by another process.

I'm using this code:

@echo off
echo.

:: Setting Variables
set SVN_BIN=C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe
set LOG_FILE=D:\BatchScripts\logs\svn-update.log
set CMD_TITLE="SVNUpdate"
set SOURCE1=D:\www\upload.example.com\
set SOURCE2=D:\www\download.example.com\
set SOURCE3=D:\www\client.example.com\
::
::
echo. %DATE% %TIME% Updating %SOURCE1% using SVN... >> "%LOG_FILE%"
START "%CMD_TITLE%" "%SVN_BIN%" /command:update /path:"%SOURCE1%" /closeonend:1 >> "%LOG_FILE%"
::
echo. %DATE% %TIME% Updating %SOURCE2% using SVN... >> "%LOG_FILE%"
START "%CMD_TITLE%" "%SVN_BIN%" /command:update /path:"%SOURCE2%" /closeonend:1 >> "%LOG_FILE%"
::
echo. %DATE% %TIME% Updating %SOURCE3% using SVN... >> "%LOG_FILE%"
START "%CMD_TITLE%" "%SVN_BIN%" /command:update /path:"%SOURCE3%" /closeonend:1 >> "%LOG_FILE%"
::
echo. %DATE% %TIME% Operation complete. >> "%LOG_FILE%"

How can I archive to write a log file? The script will be executed every 5 minutes using Windows task scheduler.

The START parameter /wait does not help or fix the problem, but it does slow down the update process a lot, because it always waits for the current SVN update to finish and then, it will start the next update. That's not, what I want.

Sebbo
  • 65
  • 1
  • 1
  • 9
  • Use a different log for every source? –  Jun 23 '17 at 10:20
  • 2
    Possible duplicate of [TortoiseSVN command keeps open processes](https://stackoverflow.com/questions/43039658/tortoisesvn-command-keeps-open-processes) – Compo Jun 23 '17 at 11:02
  • @Compo No, that's a different problem. I'm talking about redirecting something to a log file. This post is talking about non-closing TortoiseSVN processes. – Sebbo Jun 23 '17 at 11:50
  • @LotPings That also doesn't help. I've already tried to only log the `echo`, but this has also already the problem. – Sebbo Jun 23 '17 at 11:51
  • @Sebbo, you are trying to run several non interactive commands using an interactive command process. The advice in the post I linked was clear, **If you want to write a script which requires no input, you should use the official Subversion command line client instead**. My suggestion therefore is that you try doing just that and feed back the results. – Compo Jun 23 '17 at 12:03

1 Answers1

2

TortoiseProc.exe is not the tool for this task. You should use svn.exe for this kind of automation. Read the documentation:

Remember that TortoiseSVN is a GUI client, and this automation guide shows you how to make the TortoiseSVN dialogs appear to collect user input. If you want to write a script which requires no input, you should use the official Subversion command line client instead.

bahrep
  • 26,679
  • 12
  • 95
  • 136
  • Great - thanks for the information! How-to get `svn.exe`: https://stackoverflow.com/questions/2967176/where-is-svn-exe-in-my-machine – Sebbo Jun 23 '17 at 12:05