Automating TortoiseSVN on Windows to Update Multiple Repositories

Working with SVN on Windows is pretty much synonym to using TortoiseSVN I guess. If you are running a trunk version of WordPress, maintaining plugins or doing anything else collaboratively, chances are you're using this nice piece of software.

When you log to you computer to get some coding work done, what is your first task? If "I manually update several SVN repositories", the following is for you. TortoiseSVN has command line support that, even on Windows, can make things easier.

Create a batch file, name it like updateSVN.bat, and paste:

  1. @echo off
  2. FOR %%A IN (
  3.     "E:\home\ozh\wordpress\"
  4.     "E:\svn\someplugin\"
  5.     "E:\svn\someproject\"
  6. ) DO START TortoiseProc.exe /command:update /path:%%A /closeonend:0

A few comments:

  • The "FOR %%A" loop will contain, obviously, paths to the projects you want to update.
  • The "START" bit means "start asynchronously, ie don't wait for end of previous task to launch next one" so that all the Update windows will pop up simultaneously.
  • the "/closeonend:0" means, you guessed, "don't close the Update window once it's done", so you can actually see what has been updated.

There you go. You can even put this .bat file in your startup folder to get things updated when you turn your computer on.

15 comments

  1. Robert

    The must be a reason why you won't use "svn up E:\home\ozh\wordpress\ E:\svn\someplugin\ E:\svn\someproject\".

    But can't imagine which..

  2. Ozh

    Robert » Because I'm using TortoiseSVN, on Windows? i.e. I don't have a svn.exe, syntax is not the same as on Unix svn command line, etc..

  3. hemostick

    Because TortoiseSVN has its own set of binaries, it isn't just a frontend that requires you to install vanilla svn first. So, no svn from the commandline.

  4. hemostick

    Maieuh !

  5. Michael

    Thanks Ozh! Thats a cool one.

  6. Randolf

    If I want to work with command line, I'll take command line SVN and don't bother with half-baked SVN clients like Tortoise.

  7. Ozh

    Randolf » One man's opinion. I find Tortoise far from being "half-baked" and much faster to use in a visual environment than a pure command line binary.

  8. Robert

    Ozh, SVN binaries for Windows are available at http://www.collab.net/downloads/subversion/. The syntax is cross-platform.

  9. Ozh

    Robert » I know this. But as I've said, I find ToirtoiseSVN GUI unmatched.

  10. Viper007Bond

    A better solution IMO is to set up a scheduled task. Since I never turn off my computer, your BAT would never run for me. ;)

    I have a scheduled task that starts TortoiseSVN up every 15 minutes and updates multiple SVN checkouts.

    Full details (guide + pictures) on my blog.

  11. RK

    I have been looking all over for a way to start multiple TSVN updates in parallel. Using "START" while calling the command did it for me.
    Thanks a lot.

  12. Drive-by Commenter

    Thanks for the script. Worked for me, though if you need to provide an absolute path that includes a space, change line 6 to something like the following:

    ") DO START "Batch Update SVN" "C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:update /path:%%A /closeonend:0″

    "Batch Update SVN" was added because if START is followed by an argument in quotes, it uses that as the window name. You can make it anything. Then, you can use quotes in the next argument for your absolute path.

  13. ben

    Hell yeah! This is awesome :D!

  14. Trullo

    I dont like so many windows.. better use:

    1. @echo off
    2. set projects=""
    3. FOR %%project IN (
    4. "C:\Program Files (x86)\Zend\Apache2\htdocs\Project0"
    5. "C:\Program Files (x86)\Zend\Apache2\htdocs\Project1"
    6. "C:\Program Files (x86)\Zend\Apache2\htdocs\Project2"
    7. "C:\Program Files (x86)\Zend\Apache2\htdocs\Project3"
    8. "C:\Program Files (x86)\Zend\Apache2\htdocs\Project4"
    9. ) DO CALL :CONCAT %%project
    10. TortoiseProc.exe /command:update /path:"%projects:"=%" /closeonend:0;
    11. goto :eof
    12.  
    13. :CONCAT
    14. set projects=%projects%%1*
    15. goto :eof
  15. jayanth

    Tortoise SVN has user name and password, how do i specify that in the command line…

Comments are closed.