“马克” 带修改的 SVN 导出
我正在寻找以下情况的解决方案。
我们使用 Subversion,除了使用签出的开发环境之外,我们还有一个测试环境,它应该尽可能类似于生产环境。
因此,我们现在已将其设置为使用 SVN 导出来更新环境。 但是,由于我们只想要最新版本,因此我们不知道导出了什么版本。
是否有某种方法可以“标记”此导出,例如通过添加一些生成的文件来指示导出了哪个版本? (我们不想导出标签,因为我们将在一个发布周期内更新多次。)
I'm looking for a solution for the following situation.
We're using Subversion, and besides the development environment, where we use checkouts, we have a test environment, which is supposed to resemble the production environment as closely as possible.
Therefore, we now have it set up so that the environment is updated by using SVN export. However, since we just want the latest revision, we don't know what revision has been exported.
Is there some way to "mark" this export, for example by adding some generated file, that indicates which revision was exported? (We don't want to export tags, as we will be updating several times within one release cycle.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以做的一件事是确保从已知版本导出,并将该版本号写入导出中的文本文件中。
svnversion
命令将告诉您工作目录的修订号。 因此,执行svn update
获取最新版本,然后svn export
到您的部署位置,然后svnversion
将输出重定向到以下位置的文本文件:与出口相同的地方。 修订版号将是更新时的修订版,即使此后有人提交了新代码。您当然希望在 shell 脚本或其他脚本中自动执行上述过程。
One thing you could do is make sure you're exporting from a known revision, and write that revision number to a text file in the export. The
svnversion
command will tell you the revision number of a working directory. So do ansvn update
to get the latest version, thensvn export
to your deployment location, thensvnversion
redirecting the output to a text file in the same place as the export. The revision number will be the revision as of the update, even if somebody has committed new code since then.You will of course want to automate the above process in a shell script or something.
您可以在导出之前(或之后)执行 svn info /path/to/repository ,但您必须锁定以确保没有进行任何更改。
或者,使用评论中描述的技术并通过 shell 脚本进行管道传输,例如:
或
You could do
svn info /path/to/repository
just before (or after) exporting, but you'd have to lock to make sure no changes were made.Alternately, using the technique described in your comment and piping through a shell script, like:
or
或者,您可以执行
svn update
,然后从该本地副本执行svn export
。 这样做的好处是 Subversion 将使用“rsync”(或它使用的任何算法)来仅更新那些已更改的文件。 然后,您只需从本地副本导出,节省带宽,并通过本地结帐保留所有存储库信息。创建两个目录,一个用于签出,一个用于导出,然后通过两步过程进行部署:
Alternately, you could do an
svn update
and thensvn export
from that local copy. The benefit of this is that Subversion will use "rsync" (or whatever algorithm it uses) to update only those files changed. And then you just export from your local copy, saving bandwidth, and retaining all the repository information with your local checkout.Create two directories, one for checkout, and one for export, then deploy with a two-step process: