Mercurial 标记/分支策略
我当前的项目分为三个部分:网站、桌面客户端和第三方程序的插件。我们最初使用 Subversion 进行源代码控制,但在阅读 Joel 后决定尝试 Mercurial斯波尔斯基的最后一篇文章。考虑到我们之前并没有真正利用过 svn 的大部分潜力,我们认为重新开始了解源代码控制如何工作的一些基本想法将使这种转变变得容易。
然而,在设置了我们的初始存储库之后,我们不知道标记和分支应该如何在这样的项目上工作。
本质上,我们正在同时处理所有这三个部分。我们希望发布的版本是这 3 个部分的组合。目前我们正在一个存储库中工作。
对于插件部分,我们已经完成了第一次迭代,我们将其称为插件 v0.1。对于其他两个部分的第一个正式版本,我们还希望将它们称为网站 v0.1 和桌面客户端 v0.1。当所有三个部分都是 v0.1 时,我们希望有一个完整的项目 v0.1。
我们的问题是我们不确定如何管理 Hg 存储库中的所有这些。处理这个问题的最佳方法是为 3 个稳定版本创建 3 个独立的存储库,然后为当前开发创建另外 3 个存储库吗?目前,我们将所有这些都集中在一个存储库中。我们应该在分支(分支与克隆存储库有什么不同吗?)和标签中执行此操作吗?
非常感谢任何帮助。
My current project is broken down into 3 parts: Website, Desktop Client, and a Plug-in for a third party program. We had started out originally with Subversion for our source control but decided to try Mercurial after reading Joel Spolsky's final post. Considering we haven't really used the majority of svn's potential before, we figured starting fresh with some basic ideas of how source control worked would make this transition easy.
However, after setting up our initial repository, we're lost as to how tagging and branching should work on a project like this.
Essentially, we're working on all 3 of these parts at the same time. We want a release to be a combination of the 3 parts. Currently we're working in one repository.
For the Plug-in part, we have the first iteration finished which we've been referring to as Plug-In v0.1. For the first official build of the other two parts, we'd also like to refer to them as Website v0.1 and Desktop Client v0.1. When all three parts are at v0.1, we'd like to have a Full Project v0.1.
Our problem is we're not sure how to manage all of this in the Hg repository. Would the best way to handle this be to create 3 separate repositories for the 3 stable versions and then 3 more repositories for the current developments? Currently we have this all in one repository. Should we do this in branches (are branches any different from cloning repositories?) and tags?
Any help is greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我强烈推荐 Steve Losh 的博客文章 指南Mercurial 中的分支,其中描述了 Mercurial 支持的几种分支方法。
使用 Mercurial 的命名分支功能可能是与 SVN 分支最接近的匹配。
I'd highly recommend Steve Losh's blog entry A Guide to Branching in Mercurial, where he describes several approaches to branching supported by Mercurial.
Using Mercurial's named branches feature is probably the closest match to branching with SVN.
听起来您确实希望这 3 个部分有单独的存储库,如果您需要在版本中将这 3 个部分捆绑在一起,那么将这 3 个存储库设置为 子存储库。
It definitely sounds like you want seperate repos for the 3 parts, if you need to tie the 3 together in releases it may also be useful to have these 3 repositories be subrepos of an overall project repository.
您可以将它们保存在一个存储库中或将项目分开。对我来说,这取决于应用程序之间共享的代码量(如果有)。如果组件之间未共享代码,请为每个组件使用不同的存储库。
单独的存储库将允许您轻松地使用版本 (v0.1) 标记每个组件,然后根据需要继续进行开发。当您准备好发布组合产品时,只需从每个存储库中提取所需的标签即可获得完整的产品版本。如果您的应用程序可交付成果与这三个组件中的任何一个都不相关,您还可以为组合产品创建一个存储库来保存该数据。您可以通过分支或克隆存储库处理每个组件的分支。
如果您将组件保留在单个存储库中,它仍然可以工作,但您的标签和分支会变得更加混乱。当插件达到 v0.1 时,为其创建一个标签,例如“插件 v0.1”。对桌面和 Web 客户端执行相同的操作。然后,当您想要发布该产品时,您将需要从三个不同的标签中提取每个组件的 v0.1 版本。
我会选择单独的存储库。如果存在共享代码,则决策会更加复杂,但您可以找到将依赖项作为库而不是代码的方法。
对于有关分支的问题,这篇文章 是了解不同选项和优缺点的良好指南。
You can keep them in one repository or separate the projects. For me, it would depend on how much of the code, if any, is shared between the applications. If code isn't shared between the components, use a different repository for each.
Separate repositories would allow you to easily tag each component with the version (v0.1) and then continue forward with development as needed. When you are ready to release a combined product, just pull from the desired tag for each repository and you'll get the full product release. If you have deliverables for the application that are not related to either of the three components, you can also create a repository for the combined product to keep that data. You can handle branching for each of the components through branches or cloned repositories.
If you keep the components in a single repository, it will still work but your tags and branches will get much messier. When the plug-in gets to v0.1, create a tag for that like "plug-in v0.1". Do the same thing for the desktop and web clients. Then when you want to release the product, you will need to pull from three different tags which has each component at v0.1.
I would opt for the separate repositories. The decision is more complicated if there is shared code but you could find ways to take your dependencies as libraries rather than code.
For your questions about branching, this article is a good guide to the different options and pros/cons.
尝试使用 Joel 的 Mercurial 教程。这可能会产生更多的结果或如何使用它。 SVN 中确实没有使用“分支”,而且确实,停止尝试像使用 SVN 一样使用 Mercurial 可能是个好主意。您拥有自己的本地存储库,而不是分支。
Try using Joel's Tutorial on Mercurial. This might yield a bit more or how to use it. There really isn't a "Branching" as used in SVN and really, it might be a good idea to stop trying to use Mercurial as if it was SVN. Instead of Branching, you have your own local Repositories.