Command line to update SVN folders

16,485

Solution 1

It might be easier in PowerShell:

Set-Alias tsvn 'C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe'
dir C:\workspace | %{ tsvn /command:update /path:"$($_.FullName)" /closeonend:2 }

Or if you want to specify certain project directories:

cd C:\workspace
$projects = 'Proj 1','Proj 2','Proj 3'
$projects | %{ tsvn /command:update /path:"$_" /closeonend:2 }

PowerShell scripts have a ps1 extension. You might also have to update the execution policy to allow scripts to run:

Set-ExecutionPolicy RemoteSigned

Solution 2

Just use the SVN command line itself:

pushd "%SOURCE%"
svn update
popd

You can get the Subversion tools for Windows at http://subversion.tigris.org/getting.html#windows. Install them side by side with TortoiseSVN.

Share:
16,485

Related videos on Youtube

Josh Knutson
Author by

Josh Knutson

Coldfusion Developer, Javascript entertainer, CSS Guru, or Front End Ninja has a few people have called me

Updated on June 04, 2022

Comments

  • Josh Knutson
    Josh Knutson almost 2 years

    I have tried several things so far, but I haven't had much luck yet. I'm attempting to have a command line or PowerShell script that I can run once a day to make sure my numerous checked-out projects are up to date.

    I know I would be looping through the directory folders inside my workspace, but when setting the variables I haven't had any luck as it will error out. I am using TortoiseSVN, and Windows Vista.

    Here is what I have so far:

    echo == Initiating system instance variables...
    echo. -- Setting the variables...
    
    :: Here you need to make some changes to suit your system.
    set SOURCE=C:\workspace\Project
    set SVN=C:\Program Files\TortoiseSVN\bin
    :: Unless you want to modify the script, this is enough.
    
    echo. %SOURCE%
    echo. %SVN%
    echo. ++ Done setting variables.
    echo.
    echo == Updating source from SVN
    echo. -- Running update...
    "%SVN%\TortoiseProc.exe" /command:update /path:"%SOURCE%" /closeonend:2
    echo. ++ Done.
    
    echo. -- Cleaning up...
    set SOURCE=
    set SVN=
    echo. ++ Done.
    
    @echo off
    
    • J. Polfer
      J. Polfer almost 15 years
      Ummm... Why do you have to use TortoiseSVN? It makes far more sense to use the regular win32 svn commandline client, primarily because the regular client was designed from the get-go for command line work and automation.
  • hometoast
    hometoast almost 15 years
    Unless installed separately, tortoise doesn't come with the command line interface.
  • Groo
    Groo almost 15 years
    Actually, there is a command line tool that comes with Tortoise (SubWcRev.exe).
  • Groo
    Groo almost 15 years
    No, sorry, we use it to update out source files with a rev. number, it cannot be used to update/commit.