如何自动更新Subversion工作副本?

时间:2021-09-05 00:29:48

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?

有谁知道如何自动运行svn update?如果有人有脚本或类似的东西,你能告诉我一个例子吗?

5 个解决方案

#1


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

我正在使用TortoiseSVN。在生产服务器上,我有一个运行以下批处理文件的计划任务。

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

Hopefully this saves someone else some time!

希望这能节省别人的时间!

#2


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!

我使用SVN Notifier,它位于系统托盘中,每次存储库更改时都会通知我。我强烈推荐它。这意味着您只有在有更新内容时才会更新!

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

或者,您可以设置计划的任务/计算机作业,以便每小时/每天/每小时在相应的目录中运行svn update。


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:

您需要一个名为svnUpdate.bat的批处理文件或类似下面的内容:

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.

确保安装了svn的命令行版本(我使用SlikSvn)并在PATH上可用(在命令窗口中键入svn并确保它显示'Type svn help ...'或类似内容。

#3


@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.

如果您使用TortoiseSVN,则上述批处理脚本将适合。否则,您可以修改它以使用您当前使用的任何SVN客户端。只需在.bat文件中弹出它并按需运行它。

#4


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.

您还可以从http://code.google.com/p/commitmonitor/下载并使用Commit-Monitor。它监视SVN存储库以进行提交,并在发生时通知用户。它在GNU GPL中,版本2。

#5


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. 切勿更改本地存储库中的任何内容。

  3. Read this link on how to use AT to schedule from the command line in windows.
  4. 阅读此链接,了解如何使用AT从Windows中的命令行进行计划。

  5. Use the AT command to schedule the following command (assuming you have the command-line version of svn installed):

    使用AT命令安排以下命令(假设您安装了svn的命令行版本):

    svn update reporsitory_directory

    svn update reporsitory_directory

  6. Profit!

#1


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

我正在使用TortoiseSVN。在生产服务器上,我有一个运行以下批处理文件的计划任务。

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

Hopefully this saves someone else some time!

希望这能节省别人的时间!

#2


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!

我使用SVN Notifier,它位于系统托盘中,每次存储库更改时都会通知我。我强烈推荐它。这意味着您只有在有更新内容时才会更新!

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

或者,您可以设置计划的任务/计算机作业,以便每小时/每天/每小时在相应的目录中运行svn update。


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:

您需要一个名为svnUpdate.bat的批处理文件或类似下面的内容:

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.

确保安装了svn的命令行版本(我使用SlikSvn)并在PATH上可用(在命令窗口中键入svn并确保它显示'Type svn help ...'或类似内容。

#3


@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.

如果您使用TortoiseSVN,则上述批处理脚本将适合。否则,您可以修改它以使用您当前使用的任何SVN客户端。只需在.bat文件中弹出它并按需运行它。

#4


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.

您还可以从http://code.google.com/p/commitmonitor/下载并使用Commit-Monitor。它监视SVN存储库以进行提交,并在发生时通知用户。它在GNU GPL中,版本2。

#5


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. 切勿更改本地存储库中的任何内容。

  3. Read this link on how to use AT to schedule from the command line in windows.
  4. 阅读此链接,了解如何使用AT从Windows中的命令行进行计划。

  5. Use the AT command to schedule the following command (assuming you have the command-line version of svn installed):

    使用AT命令安排以下命令(假设您安装了svn的命令行版本):

    svn update reporsitory_directory

    svn update reporsitory_directory

  6. Profit!