在 Mercurial 中合并书签
昨天问了关于 Mercurial 分支的这个问题之后,我'我们决定尝试短期分支(功能)的书签,如下所示。
然而现在,当我尝试将我的书签头合并到开发修订版中时,我收到以下错误:
hg update dev-1.1
hg merge feature1
abort: nothing to merge
我做错了什么?
我的存储库的图形表示:
o changeset: 5:fa2b19961b46
| bookmark: feature1
| description: Work on feature 1 finished.
|
| o changeset: 4:6ea0155d4d89
| | bookmark: feature2
| | description: Work on feature 2 started.
| |
o | changeset: 3:44e335b5426c
| | bookmark: feature1
|/ description: Work on feature#1 started.
|
@ changeset: 2:407b3b94624f
| tag: dev-1.1
| description: Development for release 1.1 started.
After asking this question yesterday about branching in mercurial, I've decided to try out bookmarks for short-lived branches (features), as shown below.
However now when I am trying to merge my bookmarked heads together into the development revision, I get below error:
hg update dev-1.1
hg merge feature1
abort: nothing to merge
What am I doing wrong?
Graphical representation of my repo:
o changeset: 5:fa2b19961b46
| bookmark: feature1
| description: Work on feature 1 finished.
|
| o changeset: 4:6ea0155d4d89
| | bookmark: feature2
| | description: Work on feature 2 started.
| |
o | changeset: 3:44e335b5426c
| | bookmark: feature1
|/ description: Work on feature#1 started.
|
@ changeset: 2:407b3b94624f
| tag: dev-1.1
| description: Development for release 1.1 started.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
就像它说的那样,没有什么可以合并 - 你应该使用更新:
你只能合并历史的不同部分,这里的
dev-1.1
变更集只是feature1< 的祖先。 /代码> 变更集。 Mercurial 2.1 在这种情况下表示
,我们希望这将使错误更加清晰。
如果您已为
dev-1.1
变更集添加了书签(而不是标记它),那么普通内容现在(使用 Mercurial 2.1)将导致
dev 的更新 -1.1
书签。因此,如果您从然后更新开始:
那么书签就会更新:
对于早期版本,您必须执行
以下操作 如果普通的
hg update
无法将您带到正确的变更集,例如,如果您想与feature2
进行“合并”。当历史没有真正分歧时使用合并的想法来自Git。在该系统中,有一个快进合并的概念,这就是我们在 Mercurial 中所说的更新。
Like it says, there is nothing to merge — you should use update instead:
You can only merge divergent parts of history, and here the
dev-1.1
changeset is simply an ancestor of thefeature1
changeset. Mercurial 2.1 saysin this case and we hope this will make the error clearer.
If you had bookmarked the
dev-1.1
changeset (instead of tagging it), then a plainwill now (with Mercurial 2.1) result in an update of the
dev-1.1
bookmark. So if you start withand then update:
then the bookmark is updated:
With earlier versions, you would have to do
This still applies if a plain
hg update
doesn't take you to the right changeset, e.g., if you had wanted to "merge" withfeature2
instead.The idea of using merge when history hasn't really diverged comes from Git. In that system, there is a notion of a fast-forward merge, which is what we call an update in Mercurial.
如果变更集已公开,如果您想坚持将每个功能作为存储库中的合并,则可以强制 Mercurial 进行合并:
如果变更集尚未公开,您可以将变更集折叠为一个:
If the changesets have been made public, you can force Mercurial to do a merge if you want to insist on having each feature as a merge in the repository:
If the changesets have not been made public, you can collapse the changesets into one: