在 Mercurial 中处理项目的两个版本的工作流程
我有一个版本 1.0
的应用程序。我现在需要开始 2.0
版本的工作,但同时维护和修复 1.0
版本中的错误。
1.0
中的错误修复将合并到 2.0
版本中,但不会将任何新功能从 2.0
向后移植到 1.0
> 释放。
我了解分支的工作原理,但是我需要能够同时处理两个版本,因此在同一工作文件夹中的分支之间切换是不切实际的。我希望能够同时运行两个版本的代码。
能够同时使用命名分支处理同一应用程序的两个版本的典型设置或工作流程是什么?即使用一个文件夹中的一个分支和另一个文件夹中的另一个分支?
我是否只需将存储库克隆到版本 2.0
的新文件夹中,并将分支设置为 2.0
版本的分支?
我对 Mercurial 有点陌生,所以如果这听起来有点天真,请原谅我。
I have an application that is version 1.0
. I now need to start work on version 2.0
but at the same time maintain and fix bugs in version 1.0
.
Bug fixes from 1.0
will be merged into the 2.0
release but no new functionality will be backported from the 2.0
to 1.0
release.
I understand how branches work however I need to be able to work on both versions at the same time so switching between branches in the same working folder isn't practical. I want to be able to run both versions of the code at the same time.
What is a typical setup or workflow for being able to work on two versions of the same application using named branches at the same time? i.e. working with one branch in one folder and another branch in another folder?
Do I just clone the repository into a new folder for version 2.0
and set the branch to the one for the 2.0
release?
I'm a bit new to Mercurial so please forgive me if this sounds a bit naive.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,每个主要版本都有一个单独的克隆就可以了。但是,您应该将主要开发保留在
default
分支并使用为每个主要版本命名分支。让我介绍一下工作流程:当您的版本 1.0 完成后,您
就可以继续在该克隆中工作以实现版本 2.0。当您发现需要修复 1.0 中的错误时,您
只需在第一次推送时才需要
--new-branch
标志。它告诉 Mercurial 您确实想在历史记录中创建一个新的永久分支。您现在想要将错误修复拉入其他存储库:
通过使用 1. 的命名分支。 x 系列,您始终可以使用
hg update 1.x
转到该分支上的最新变更集。将1.x
视为一个“浮动标记”,它始终指向该分支上最尖端的变更集。标准分支 wiki 页面中描述了此工作流程。
Yes, a separate clone for each major release will just fine. However, you should keep your main development on the
default
branch and use named branches for each major release. Let me run through the workflow:When your version 1.0 is done, you do
and you can then continue working in that clone towards version 2.0. When you find that you need to fix a bug in 1.0, you do
The
--new-branch
flag is only necessary the first time you push. It tells Mercurial that you really do want to create a new permanent branch in the history.You now want to pull the bugfix into the other repository:
By using a named branch for the 1.x series, you can always use
hg update 1.x
to go to the latest changeset on that branch. Think of1.x
as a "floating tag" that always point to the tip-most changeset on that branch.This workflow is described in the standard branching wiki page.