“Mark” SVN export with revision

馋奶兔 提交于 2019-12-06 04:02:27

问题


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


回答1:


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 an svn update to get the latest version, then svn export to your deployment location, then svnversion 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.




回答2:


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:

svn export /path/to/repository | grep ^Exported > revision.txt

or

svn export /path/to/repository | tail -l > revision.txt



回答3:


Alternately, you could do an svn update and then svn 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:

svn update /path/to/repository checkout/project
svn export checkout/project export/project


来源:https://stackoverflow.com/questions/975083/mark-svn-export-with-revision

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!