为 SVN 用户推荐的 Mercurial 存储库/文件夹结构

发布于 2024-08-23 17:18:51 字数 318 浏览 5 评论 0原文

我正在尝试使用 Hg,以期摆脱 SVN,但想要一些关于如何构建我的 Hg 存储库的意见。我有 SVN 背景(这可能会影响我对其工作方式的看法!),我的存储库目前看起来像这样:

Project1
  trunk
  branches
    1.0
    1.1
Project2
  trunk

等等。这似乎是构建 SVN 存储库的“传统”方式。

我应该如何用汞重现这个?为了让这一点变得有趣一点,我喜欢“稳定”、“qa”和“开发”存储库/文件夹的想法,如果可能的话,想介绍一下。

我是汞初学者,因此欢迎任何帮助或建议。

I am experimenting with Hg with a view to moving away from SVN but wanted some opinions on how I should structure my Hg repository. I come from a SVN background (which may of tainted my outlook on how this should work!) and my repository currently looks something like this:

Project1
  trunk
  branches
    1.0
    1.1
Project2
  trunk

etc. This seems to be the 'traditional' way to structure an SVN repository.

How should I reproduce this with Hg? To spice this up a little I like the idea of 'stable', 'qa' and 'dev' repositories/folders and would like to introduce this if possible.

I am an Hg beginner so any help or advice is welcome.

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

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

发布评论

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

评论(3

意犹 2024-08-30 17:18:51

Subversion (SVN) 和 Mercurial (HG) 存储库(简称 repo)之间存在一些结构差异,这意味着您将如何“设计”层次结构:

  • 每个存储库只有一个项目,Mercurial 的工作效果会更好 :因为您总是必须克隆整个存储库,所以在单个存储库中拥有多个项目可能会对克隆时间以及推/拉操作产生很大影响,因为您必须同步已完成的所有作业每次都在其他项目而不是你的项目上。
  • SVN 没有“强大”的标记/分支概念,而 Mercurial 有:在 SVN 中(在撰写本文时),每个分支、每个标签基本上都是给定项目的副本/文件夹/无论什么。推荐的 trunk/branches/tags 结构可以帮助您找到“副本”,仅此而已。另一方面,分支和标签在 Mercurial 中定义良好。标签实际上是您为特定修订添加的名称,您可以请求所有现有标签。对于分支,您会看到有 很多处理它们的方法,但最适合 SVN 哲学的方法是命名分支。

考虑到这一点,并将其与稳定、质量保证 (QA) 和开发 (dev) 流程的想法结合起来,我建议如下:

  • 每个项目一个名为“稳定”的存储库。每个项目有几个“QA”存储库,每个项目有大量“Dev”。
  • 标签和名称分支仅由“稳定”存储库定义,或最终由“QA”定义。 “Dev”存储库可以以不同的方式处理它们,而不会造成伤害。
  • 你永远不会推送“QA”或“稳定”存储库,他们会拉取,或者集成捆绑包或补丁,并且每个人都有一个人负责。

示例:MyProject-1.0

 [STABLE Repository, pulls from any/all QA]
  - MyProject-1.0

 [QA Repositories, branched from STABLE, pulls from any/all DEV ]
  - QA_MyProject-001 (Person A)
  - QA_MyProject-002 (Person B)
  - QA_MyProject-003 (Person C)
            ...
  - QA_MyProject-### (Person #)

 [DEV Repositories, branched from STABLE or QA]
  - DEV_MyProject-001 (Feature X) 
  - DEV_MyProject-002 (Feature Y)
  - DEV_MyProject-003 (Feature Z)
            ...
  - DEV_MyProject-### (Feature #)

  1. DEV completes feature(s)
  2. QA pulls feature(s) from DEV
  3. STABLE pulls from all approved QA(s) (consolidating all changes)

There are several structural differences between a Subversion (SVN) and Mercurial (HG) repository, or repo for short, implies how you'll "design" your hierarchy:

  • Mercurial works better with only one project per repository: Because you always have to clone the entire repository, having multiple project in a single repository might have a big impact on the cloning time as well as on the pushing/pulling operations, as you'll have to synchronize all the job that was done on other projects than yours each time.
  • SVN does not have a "strong" notion of tagging/branching, while Mercurial does: In SVN (at the time of writing), each branch, each tag, is basically a copy of a given project/folder/whatever. The recommended trunk/branches/tags structure is there to help you to find your "copies" back, no more. On the other side, branches and tags are well defined in mercurial. A tag is really a name that you put on a particular revision, and you can ask for all the existing tags. For branches, you'll see that there are MANY ways to handle them, but the one that fits best to the SVN philosophy, are named branches.

With that in mind, and coupling it with you idea of stable, quality assurance (QA), and development (dev) process, here is what I would recommend:

  • One repository named "Stable" per project. Several "QA" repos per project and tons of "Dev" per project.
  • Tags and names branches are only defined by the "Stable" repo, or eventually by the "QA". The "Dev" repos can handle them differently without hurting.
  • You never make a push to a "QA" or "Stable" repo, they pull, or they integrate bundles or patches, and there's one person responsible for each.

Example: MyProject-1.0

 [STABLE Repository, pulls from any/all QA]
  - MyProject-1.0

 [QA Repositories, branched from STABLE, pulls from any/all DEV ]
  - QA_MyProject-001 (Person A)
  - QA_MyProject-002 (Person B)
  - QA_MyProject-003 (Person C)
            ...
  - QA_MyProject-### (Person #)

 [DEV Repositories, branched from STABLE or QA]
  - DEV_MyProject-001 (Feature X) 
  - DEV_MyProject-002 (Feature Y)
  - DEV_MyProject-003 (Feature Z)
            ...
  - DEV_MyProject-### (Feature #)

  1. DEV completes feature(s)
  2. QA pulls feature(s) from DEV
  3. STABLE pulls from all approved QA(s) (consolidating all changes)
初见终念 2024-08-30 17:18:51

但在你这样做之前 - 看看这个:hginit.com - 阅读 ½ 小时,其中有一个部分svn-用户。

让我明智了很多,我决定放弃 /trunk /tag 结构,并以不同的方式使用 Mercurial。我现在为每个项目都有一个存储库,其中仅包含项目的结构,并使用 Mercurial tag 命令进行标记。

.杰斯帕·豪格

But before you do that - check this out: hginit.com - it's a ½ hour read, and it has a section for svn-users.

Made me a lot wiser, and I decided on abandoning /trunk /tag structure, and use mercurial in a different manner. I now have a repository for every project, that just contains the structure of the project, and i tag using the mercurial tag command.

.Jesper Hauge

感受沵的脚步 2024-08-30 17:18:51

Mercurial 确实有很好的文档记录。您只需要知道在 Wiki 中查找即可。

您可以查看 Mercurial 的 wiki 文章 RepositoryNaming 来找到一些答案。

您还应该阅读 Mercurial 官方手册: Mercurial:权威指南

祝你好运!

Mercurial is really well documented. You only have to know where to look in the Wiki.

You can look at Mercurial's wiki article RepositoryNaming to find some of your answers.

You should also read the official Mercurial manual: Mercurial: The Definitive Guide

Good luck!

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