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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/919822/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 06:25:31  来源:igfitidea点击:

How do I automatically update a Subversion working copy?

windowssvnscripting

提问by Matt

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吗?如果有人有脚本或类似的东西,你能给我举个例子吗?

回答by Matt

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!

希望这可以为其他人节省一些时间!

回答by Mark Pim

I use SVN Notifierwhich 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 通知程序,并在每次存储库更改时通知我。我强烈推荐它。这意味着你只在有东西要更新时才更新!

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

或者,您可以设置计划任务/cron 作业,以svn update每小时/每天/任何时间在适当的目录中运行。



EDIT:OK, take a look at this Microsoft articleon 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 svnand ensure it says 'Type svn help...' or similar.

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

回答by varl

@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 文件并按需运行即可。

回答by Vipin Hari

You can also download and use Commit-Monitorfrom 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 中。

回答by Elijah

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 ATto 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!

  1. 永远不要更改本地存储库中的任何内容。
  2. 阅读此链接,了解如何使用 AT从 Windows 中的命令行进行调度。
  3. 使用 AT 命令调度以下命令(假设您安装了命令行版本的 svn):

    svn 更新repository_directory

  4. 利润!