使用非分层代码的版本控制? [英] Using version control with non-hierarchical code?

查看:21
本文介绍了使用非分层代码的版本控制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑将运行多个网站的代码库放入版本控制中.此代码库有多个实例在不同的虚拟服务器上运行网站.

I am looking at putting a code base that runs several website into version control. There are several instance of this code base running websites on different virtual servers.

我正在解决的问题是,这些或多或少相同代码的独立实例中的每一个都有具有特定于站点的功能的子目录.但似乎版本控制系统想要控制整个目录层次结构.

The problem I'm grappling with is that each of these separate instances of more or less the same code have sub-directories with site-specific functions. But it seems that version control systems want to control the entire directory hierarchy.

比如每个实例都有目录

/www/smarty/libs/plugins/

您可以在其中找到 smarty 的站点特定功能.当我们准备将其放入版本控制时,文件夹 /www 将是根目录.

Where you'll find site-specific functions for smarty. When we are ready to put it into version control, the folder /www would be the root.

因此,一种选择是将所有特定于站点的功能提供给所有站点.我没有看到问题本身,但它似乎在某种程度上在架构上是错误的".会有一堆文件只属于一个部署.

So one option is to have all the site-specific functions going out to all sites. I don't see a problem in and of itself, but it seems somehow architecturally 'wrong'. There would be a bunch of files that only belong to one deployment.

另一种选择是在代码库中为每个站点的特定文件创建一个单独的存储库.但这听起来像是在尝试正确部署新网站时很快就会变成一场噩梦.

Another option is to have a separate repository for each site's specific files within the code base. But that sounds like it could quickly become a nightmare when trying to get new sites deployed properly.

这样做的最佳方法是什么?我们正在研究的版本控制系统是 subversion.

What's the best way to do this? The version control system we're looking at is subversion.

推荐答案

一般来说,应该使用源代码控制系统来控制源代码.他们无法完全控制文件层次结构、权限和其他相关内容.这些最好留给部署配置.

Generally, source control systems should be used to control source. They are not at their best completely controlling file hierarchies, permissions, and other related things. These are best left to deployment configuration.

让您需要的每个项目和目录在版本控制系统中出现一次怎么样.然后,在一个单独的目录(可能称为 /build/)中,拥有各种配置布局.您可能有一个构建每个站点的 ant 文件或 maven.或者您可以使用诸如 CapistranoFabric 以更好地控制每个部署.

How about having each of the projects and directories you need represented once in the version control system. Then, in a separate directory (perhaps called /build/), have the various configuration layouts. You might have an ant file that builds each site, or maven. Or you can use tools like Capistrano or Fabric to have more control over each deployment.

这篇关于使用非分层代码的版本控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆