How do I automatically update a Subversion working copy?

前端 未结 5 1738
梦毁少年i
梦毁少年i 2020-12-02 08:20

Does anybody know how I can automatically run svn update? If anybody has a script or something like that, could you show me an example?

相关标签:
5条回答
  • 2020-12-02 08:56

    You can also download and use Commit-Monitor from http://code.google.com/p/commitmonitor/. It monitors SVN repositories for commits and notifies the user when it happens. It is in GNU GPL, ver 2.

    0 讨论(0)
  • 2020-12-02 09:04

    I use SVN Notifier which sits in the system tray and notifies me every time the repository changes. And I can highly recommend it. It means you only update when there's something to update!

    Alternatively you can set up a scheduled task/cron job to run svn update in the appropriate directory every hour/day/whatever.


    EDIT: OK, take a look at this Microsoft article on setting up a scheduled task.

    You want a batch file called svnUpdate.bat or something which looks like this:

    cd C:/path/to/your/working/copy
    svn update
    

    Get the scheduled task to run this as often as you like (once an hour seems sensible)

    Make sure you have the command line version of svn installed (I use SlikSvn) and available on your PATH (in a command window type svn and ensure it says 'Type svn help...' or similar.

    0 讨论(0)
  • Note: Once I know your operating system, I will be able to give you a more detailed answer.

    General Instructions

    1. Never change anything in the local repository.
    2. Read this link on how to use AT to schedule from the command line in windows.
    3. Use the AT command to schedule the following command (assuming you have the command-line version of svn installed):

      svn update reporsitory_directory

    4. Profit!

    0 讨论(0)
  • 2020-12-02 09:09

    I'm using TortoiseSVN. On the production server I have a scheduled task that runs the following batch file.

    CD C:\Program Files\TortoiseSVN\bin\
    START TortoiseProc.exe /command:update /path:"C:\www\MyRepo\" /closeonend:0
    

    Hopefully this saves someone else some time!

    0 讨论(0)
  • 2020-12-02 09:09
    @echo off
    
    cls
    echo == Initiating system instance variables...
    echo. -- Setting the variables...
    
    :: Here you need to make some changes to suit your system.
    set SOURCE=C:\sauce\CURRENT
    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.
    

    If you are using TortoiseSVN then the above batch script will suit fine. Otherwise you can just modify it to use whatever SVN client you are currently using. Just pop this in a .bat file and run it on demand.

    0 讨论(0)
提交回复
热议问题