问题描述
在工作中,我们有一个Windows Server 2003与IIS和Subversion安装。我们用它来发布和测试本地
我们的ASP.NET网站。每个程序员都在他的电脑上安装了Tortoise,并可以更新/提交内容到服务器。托管存储库工作正常。
但是保存在这些存储库中的文件需要被复制到我们的本地IIS(虚拟目录)。
At work, we have a windows server 2003 with IIS and Subversion installed. We use it to publish and test locallyour ASP.NET websites. Every programmer has Tortoise installed on his PC and can update/commit content to the server. Hosting the repositories is working fine.But the files kept in those repositories needs then to be copied to our local IIS (virtual directories).
将这些subversion版本库发布到本地IIS的简单方法是什么?
What is an easy way to publish those subversion repositories to our local IIS?
>
感谢我添加了一个简单的bat文件,在每次提交时都会执行(检查 subversion文档)。我的bat文件只包含:
Thanks to puetzk I added a simple bat file that gets executed every time a commit occurs (check the subversion documentation about hooks). My bat file only contains:
echo off
setlocal
:: Localize the working copy where IIS points)
pushd E:\wwwroot\yourapp\trunk
:: Update your working copy
svn update
endlocal
exit
推荐答案
-
只需将Web服务器的文件区域保存为工作副本,并在每次要发布时执行svn。配置它以隐藏.svn文件夹的内容,如果他们看起来不整洁(我不知道该怎么做,但我认为它可以完成)。
Just keep the web server's file area as a working copy, and perform an svn up in it whenever you want to "publish". Configure it to hide the contents of the .svn folders if they seem untidy to you (I don't specifically know how to do this, but I assume it can be done). They will already have the filesystem hidden bit, which may take care of this.
如果你想要它真的自动(一旦有人提交更新),请使用
If you want it really automatic (updates as soon as someone commits), use a post-commit hook script on the SVN server to kick off the first process.
其他在评论中提出的建议使用导出而不是检出。这也可以工作,并避免.svn杂乱,但有两个缺点。一个,它必须每次重新下载整个内容,而不仅仅是修改的文件(因为它没有保持.svn dir记住它有)。如果你有很多文件,这将是更慢。二,update以原子方式替换文件(在.svn / tmp中写入新版本,然后将其移动到位)。导出将文件逐步写入其下载的目标。这意味着导出可能会向在错误的时间浏览它的人提供不完整的文件。
Others in the comments have suggested using export instead of checkout. That can work too, and avoids the .svn clutter, but has two drawbacks. One, it has to redownload the entire contents every time, not just the modified files (since it didn't keep the .svn dir to remember what it has). If you have a lot of files, this will be much slower. Two, update replaces the file atomically (writes the new version in .svn/tmp, then moves it into place). Export writes the file gradually into it's destination as it downloads. That means export could deliver an incomplete file to someone who browsed it at just the wrong time.
这篇关于如何将subversion存储库发布到本地IIS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!