Subversion - 合并存储库 [英] Subversion - Merging Repositories

查看:26
本文介绍了Subversion - 合并存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我第一次为我的不同项目设置 SVN 结构时,我决定将每个不同的项目放在一个单独的存储库中.

When I first setup the SVN structure for my different projects, I decided to place each different project in a separate repository.

这已经运行了一段时间了,但我开始认为我想将所有这些存储库合并到一个整体的公司范围"存储库中,这样当我让员工检查源代码时,他们就可以只需从顶部签出即可获得所有不同项目的所有代码.

This has worked well for a while, but I'm staring to think that I would like to merge all of those repositories into one overall "company-wide" repository so when I have employees check out the source code, they can just checkout from the top and have all the code from all the different projects.

我在网上找到了 svn-merge-repos 命令,但没有很多用户反馈或有用的使用提示.这是加入存储库的最佳方式,所以我不会丢失我的历史数据,还是有更好的方法?有什么需要注意的陷阱吗?

I found the svn-merge-repos command online, but not a lot of user feedback or helpful tips for using it. Is this the best way to join repositories so I don't loose my history data, or is there a better way? Are there any pitfalls that I should watch out for?

谢谢.

推荐答案

请不要强迫您的用户签出整个存储库来构建内容.这是在追溯到旧的 sourcesafe 模型,当时它并不好.

Please please please don't force your users to checkout an entire repository to get things to build. This is harking back to the old sourcesafe model and it wasn't good then.

每个项目有一个存储库很好.如果 project1 需要来自 project2 的代码,请将svn:externals"属性添加到 project1 的主干,将 project2 带到 project1 目录下的合理位置.如果 project2 需要 project3 的代码,它也可以有一个外部属性并将代码放在它下面.

Having one repository per project is fine. If project1 needs code from project2, add an "svn:externals" property to the trunk of project1 which brings project2 into a sensible place under project1's directory. If project2 needs project3's code, it too can have an external property and bring the code in underneath it.

如果外部引用始终指向标签或特定修订版,实际上最好,但如果您避免一个巨大的项目空间"问题,我会让您不要指向主干.

It's actually best if the externals references always points to a tag or a specific revision, but I'll let you off pointing to trunk if you avoid the "one huge projectspace" issue.

如果您使用外部组件,任何人都可以检出他们想要的项目,然后自动获取所有依赖项,然后构建——就像您想要的那样.他们的所有代码都独立在一个工作目录中,该目录只包含他们需要的内容,他们可以将多个项目的多个版本检出到单独的工作目录中,而不会浪费空间,并且仍然可以跟踪到底发生了什么.

If you work with externals, anyone can just checkout the project they want and automatically get all the dependencies and just build away - just as you want. All their code is self-contained in a single working directory that contains just what they need, they can checkout multiple versions of multiple projects into separate working directories without wasting space and still keep track of what the hell is going on.

如果 project1 希望在其项目文件夹之外而不是在其内部找到 project2,则可能需要对您的工作区进行一些小幅重构,但这是总体方案中的一个小调整.

It may require some minor refactoring of your workspace if project1 expects to find project2 outside of it's project folder rather than inside, but that's a minor tweak in the grand scheme of things.

如果你真的把你的心放在一个存储库上,那也没关系(这就是我们在我的工作场所和家里使用的,想想看),但是请确保你有一个结构,其中每个项目都有它自己的标签、trunk &branch 文件夹,并且检查 project1 的主干是您需要做的所有来获取要构建的 project1 的代码.

If you really have your heart set on a single repository, that's fine too (that's what we use at my workplace, and at home, come to think of it), however do ensure that you have a structure where each project has its own tags, trunk & branches folders, and that checking out the trunk of project1 is all you need to do to get the code for project1 to build.

最后,如果你真的需要一个时髦的项目布局,你可以添加一个额外的单一存储库,它基本上是一个元存储库.此存储库将包含每个顶级项目的 1 个目录(带有主干标签和分支),并使用外部引用所有其他项目并完全按照您期望的方式构建时髦的工作区.

Finally, if you really need a funky layout for your projects, you can add an extra single repository, which is basically a meta-repository. This repository will contain 1 directory per top level project (with trunk tags & branches), and using externals, reference all the other projects and build the funky workspace in exactly the way you'd expect.

通过这种方式,通过添加额外的存储库,您可以获得一步检出和构建的所有好处,并且至少有机会管理项目 1 所需的更改由于与项目 2 共享的代码而破坏项目 3 的情况,并且您突然需要为 project3 进行紧急修复.

This way, by adding the extra repository, you get all the benefits of checking out and building in one step and at least stand a chance of managing situations where changes required for project1 break project3 because of code shared with project2, and you suddenly need to get an emergency fix out for project3.

这篇关于Subversion - 合并存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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