Web 开发的 Subversion

发布于 2024-07-11 10:39:25 字数 578 浏览 6 评论 0原文

我读过很多关于 Subversion 以及将信息推送到 Web 服务器的文章,但我仍然遇到困难。

我可以了解有关创建存储库和签出等的基础知识,但我需要 Web 服务器部分的帮助。

我正在运行 Apache,而 Subverion 正在我正在处理的开发服务器上运行。

现在,我是在 **htdocs** 文件夹中与实时 Web 文档一起创建存储库,还是在 htdocs 文件夹之外创建它。

拥有存储库后,我将新创建的存储库导入到我的实时 Web 文件夹中,这使我可以将文件调用到本地计算机上进行编辑,然后将它们提交到开发服务器。

我首先想知道正确的方法,其次,如何自动将文件从新更新的存储库移动到实时 Web 文件夹?

请大家给我一些建议,我已经找了很长时间了。 谢谢

编辑

无论如何你可以帮助我完成提交后脚本,我想如果我能让这个工作我就能实现我所需要的。

我希望能够在本地更改代码,然后在完成提交后将其发送到存储库,然后自动发送到 htdocs 文件夹。

I've read a lot of articles about Subversion and pushing the information to a web server, but I'm still having difficulties.

I can understand the basics about creating the repository and checking out etc., but I need help for the web server part.

I'm running Apache and Subverion is running on the development server I'm working on.

Now do I create my repository in the **htdocs** folder along with my live web documents or do I create it outside of my htdocs folder.;

Once I have my repository I import the newly created repository into my live web folder, which is allowing me to call the files onto my local machine edit them and then commit them to the development server.

I want to know firstly the correct way and secondly, how do I automatically move the files from the newly updated repository to the live web folder?

Please any advice I've been searching for a long time. Thanks

EDIT

Is there anyway you could help me with the post-commit scripts, I think if I can get this to work I'd be able to achieve what I need.

I'd like to be able to make changes to my code locally then when I'm finished committing it, which is sent to the respository and then automatically sent to the htdocs folder.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

妄司 2024-07-18 10:39:25

您的存储库有一个标准的文件夹结构,通常至少包含一个“主干”和“分支”文件夹。 这是因为 Subversion 允许您创建一个分支(它复制主干并允许并发提交),这样您就可以处理网站的“版本 2”。

就我个人而言,我不会在 htdocs 文件夹中创建您的存储库,我会在该文件夹之外创建您的存储库。 我认为一个好的结构可能是

repo
  - trunk
    - htdocs
  - branch
    - htdocs

这样,您可以控制 htdocs 文件夹之外存在的库,这在主要网络系统中很常见,以阻止公众访问私有库。 例如,Smarty 通过将库放置在 htdocs 文件夹上方的一个目录中来采用这种方法。

There is a standard of folder structure to your repository which typically consists of at least a "trunk" and "branch" folder. This is because Subversion allows you to create a branch (it copies off the trunk and allows concurrent commits) so you can work on say "version 2" of your website.

Personally I wouldn't create your repo in the htdocs folder, I'd do it outside of that. I think a good structure may be

repo
  - trunk
    - htdocs
  - branch
    - htdocs

That way you can control libraries which exist outside of the htdocs folder, something which is common amongst major web systems to stop public access to private libraries. Smarty for example employs this approach by placing the library one directory above the htdocs folder.

嘿咻 2024-07-18 10:39:25

这个堆栈溢出问题接缝涵盖了您想要做的事情: 如何使用提交后挂钩将提交的文件从 SVN 复制到 Web 目录?

This Stack Overflow question seams to cover what you are trying to do: How can I use post-commit hooks to copy committed files to a web directory from SVN?

左耳近心 2024-07-18 10:39:25

我不确定您想要做什么,但 SVN(源代码控制系统)和持续集成系统(如 Cruise Control 或 Team City)之间是分开的。

您可以使用 apache 设置 SVN over HTTP,但这与将 Web 解决方案部署到实时服务器不同。

SVN 中没有任何东西可以自动将您的解决方案部署到 Web 服务器。 这需要通过自动构建和部署场景来完成,最好使用 CI 系统来完成。

因此,您可以在每次提交时手动检出对部署文件夹的更改,也可以设置一个 CI 系统来为您检出这些更改、运行测试并将它们部署到 Web 服务器(每次提交时) 。

我使用过 CC.NETTeam City 执行此操作; 通过一些设置,它们都可以正常工作。

I'm not sure what it is you are trying to do but there is a separation between SVN (Source Control System) and a Continuous Integration System (like Cruise Control or Team City).

You can setup SVN over HTTP with apache but that is not the same thing as deploying your web solution to a live server.

There is nothing in SVN that will automagically deploy your solution to a web server. That needs to be done with an automatic build and deploy scenario, which is best done with a CI system.

So, you can either manually check-out your changes to your deploy folder every time you do a commit or you can setup a CI system which checks them out for you, runs tests and deploys them to the web server every time there is a commit.

I've used both CC.NET and Team City to do this; they both work fine with some setup.

油焖大侠 2024-07-18 10:39:25

我们有一个与提交操作挂钩的提交后脚本,每次提交时都会将 SVN 的内容导出到 Apache 目录。 放置代码的默认位置是我们的开发和测试站点。

通过提交中的可选注释,我们导出到生产服务器。

We've got post commit script hooked on the commit action which exports content of SVN to Apache directories everytime commit is made. Default place to put the codes is our development and testing site.

With optional comment in the commit, we export to the production server.

烟花易冷人易散 2024-07-18 10:39:25

我发现 TortoiseSVN 帮助(TSVN-PDF 文件)中有针对您的大多数问题的非常好的文档。
这是我所有问题以及如何使用 SVN 设置一切的起点。
即使它是为 Windows 编写的,它也描述了如何使用 Apache 配置 SVN 等等...

也许您不想每次在存储库中签入某些内容时都更新您的实时网站。
为了更新存储库和实时网站,您可以使用构建脚本(如果您编写网站,则可以使用 NAnt与 ASP.NET)。

I find there is a very good documentation for most of your questions in the TortoiseSVN Help (TSVN-PDF file).
That was the starting point for all my questions and how to set up everything with SVN.
Even if it's written for windows, it describes how to configure SVN with Apache and so on...

Perhaps you don't want to update your live website everytime you check in something to your repository.
For updating both, repository and live website, you may use build scripts (maybe using NAnt if you write your website with ASP.NET).

情徒 2024-07-18 10:39:25

您需要开始将 Web 服务器和 SVN 存储库视为两个完全不同的事物。 SVN 只是存储文件,您可以决定存储库中文件的哪个版本以及何时放置在您的网站目录中。

最传统的方法是在存储库中保留稳定版本(称为标签),可以选择为这些标签提供版本号,然后确保始终导出最新标签并将其复制到您的网站目录。 通过这种方式执行回滚到早期版本非常简单。

You need to start seeing your webserver and the SVN repository as two completely different things. SVN does nothing more than storing files, and it's up to you to decide which version of your file(s) from the repository will be placed in your website directory, and at what time.

The most conventional way is to keep stable versions (called tags) in your repository, optionally giving these tags a version number, and then make sure that the most recent tag is always exported and copied to your website directory. Performing a rollback to an earlier version is very easy this way.

梦晓ヶ微光ヅ倾城 2024-07-18 10:39:25

另一个注意事项...

您可以签出最新版本来更新服务器或进行导出。 如果您签出,您将拥有所有可通过 Web 访问的目录,其中散布着 .svn 目录,因此请确保使用适合您的 Web 服务器的方法(例如 Apache 的 .htaccess)隐藏这些目录,或者进行导出,这样您就不会到处都有 .svn 目录。

Just another note...

You can either checkout the most recent revision to update the server or do an export. If you checkout, you'll have all your web-accessible directories littered with .svn directories, so make sure to hide those using the appropriate method for your web server (like .htaccess for Apache) or do an export so you don't have .svn directories everywhere.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文