在生产服务器上使用 subversion 使文件生效的最佳方法是什么? [英] What is the best way to make files live using subversion on a production server?
问题描述
当前,我已经设置了Subversion,以便在Eclipse PDT中进行更改时,我可以提交更改并将其保存在/home/administrator/ Project File 中.该文件具有Subversion推荐的/branches/tags和/trunk目录.我可以将文件正确上传到存储库中没有问题,但是我是否必须将Linux中的文件"mv"到/var/www才能在服务器上使用它们?是否有自动程序来执行此操作,而我却不这样做?我假设我们不想将/var/www目录(位于计算机上)存储在存储库中,但我不知道.
Currently I have subversion set up so that when I make changes in Eclipse PDT, I can commit the changes and they will be saved in /home/administrator/Project File. This file has the /branches /tags and /trunk directories recommended by subversion. I have no problem properly uploading files to the repository, but do I have to "mv" the files in Linux to /var/www in order to make them live on the server? Is there an automatic process to do this that I am missing? I'm assuming we don't want to make the /var/www directory (which is live on the machine) the repository, but I don't know.
推荐答案
您可以在您的www目录中进行 svn导出
.这将为您提供回购版本的干净"版本,而没有.svn目录.
You can do an svn export
into your www directory. That will give you a "clean" version of your repo, without the .svn directories.
cd /var/www
svn export /home/administrator/MyProject/trunk MyProject
在评论中添加一些好主意...
adding in some good ideas from the comments...
一些您想更新导出副本的选项:
Some options for when you want to update your exported copy:
- 运行
svn export --force/home/...../MyProject
,这将使它停止抱怨覆盖现有文件.这种方法意味着,如果您从存储库中删除文件,该文件仍将保留在www文件夹中. - 每次更改SVN命令以将其导出到新目录中:
svn export/home/..../MyProject_20081105
然后创建指向该文件夹的符号链接:ln -s MyProject_20081105 MyProject
每次释放"时,只需删除并重新创建符号链接即可.在这种情况下,导出目录根本不需要位于www
文件夹中.
- run
svn export --force /home/...../ MyProject
this will stop it complaining about overwriting the existing files. This method will mean that if you delete a file from your repository, it'll still remain in your www folder. - change your SVN command to export into a new directory each time:
svn export /home/..../ MyProject_20081105
and then create a symlink to that folder:
ln -s MyProject_20081105 MyProject
Just delete and recreate the symlink each time you "release". In this case, the export directory doesn't need to be in thewww
folder at all.
这篇关于在生产服务器上使用 subversion 使文件生效的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!