如果在不同的分支上,为什么我不能重新建立源变更集的祖先?
我想知道为什么以下模式不可能。
创建了一个本地功能分支(minor_feature - 不打算与世界共享)后,我想将其上的工作重新建立到一个众所周知的分支(稳定)的尖端。然而我发现,在稳定版本自分支以来没有进展的情况下,rebase 找不到任何需要重新设置的内容。
我明白这打破了变基的目的地不能是源的祖先的规则,但无法弄清楚为什么在所示的简单情况下应该禁止这种情况。我还了解到,除了分支之外,拓扑在变基期间实际上不会改变。但考虑到分支名称确实对拓扑很重要,这似乎只是一个特殊情况,因为稳定版没有对其进行进一步的修订。通过在稳定的尖端进行一次额外的修订(比如从其他地方拉入),我当然可以执行变基
o branch:minor_feature
| rev:4
| changeset:746d8191aa5d
|
o branch:minor_feature
| rev:3
| changeset:520f565ba7f2
|
@ branch:stable
| rev:2
| changeset:64e7c753c090
|
o branch:stable
| rev:1
| changeset:3dc55a5c9971
|
o branch:stable
rev:0
changeset:fbf1f426945c
$hg rebase -b minor_feature
nothing to rebase
- 谢谢 克里斯·戈尔曼
I would like to know why the following pattern is not possible.
Having created a local feature branch (minor_feature - not intended to be shared with the world) I would like to rebase the work on it on to the tip of a well known branch (stable). However I have discovered that rebase finds nothing to be rebased in the case where stable has not progressed since branching away from it.
I appreciate that this breaks the rule that the destination of rebase can not be an ancestor of the source but can't work out why this should be prohibited in the simple case shown. I also understand that, branches aside, the topology would not actually change during the rebase. But given that the branch names are indeed significant to the topology, it only seems to be a special case in that stable has no further revisions commited to it. With a single extra revision on the tip of stable (say pulled in from elsewhere) I can of course perform the rebase
o branch:minor_feature
| rev:4
| changeset:746d8191aa5d
|
o branch:minor_feature
| rev:3
| changeset:520f565ba7f2
|
@ branch:stable
| rev:2
| changeset:64e7c753c090
|
o branch:stable
| rev:1
| changeset:3dc55a5c9971
|
o branch:stable
rev:0
changeset:fbf1f426945c
$hg rebase -b minor_feature
nothing to rebase
--
Thanks
Chris Gorman
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用转换扩展来执行此操作。您可以使用分支映射将
minor_feature
变基为default
。该文件(我们将其称为alldefault
)看起来像这样:那么命令就是:
当它完成时,newrepo 将在
顶部“rebased”命名分支默认分支。
You can do this with the convert extension. You would use a branchmap to rebase
minor_feature
todefault
. That file (we'll call italldefault
) would look something like this:Then the command would just be:
When it finishes, newrepo will have the named branch "rebased" on top of the
default
branch.Rebase 严格用于更改变更集的祖先。正如你所观察到的,你并没有改变这里的血统。祖先计算中不包括分支。
我不是 100% 确定你想要完成什么。如果是为了有效地删除分支,那么只要你没有推送,你就可以使用MQ扩展。导入变更集,弹出全部。确保您已更新到稳定分支(默认情况下应该如此),然后将它们全部推回。
它们现在应该都在稳定分支上。
Rebase is strictly for changing ancestry of changesets. As you've observed, you're not changing ancestry here. Branches aren't included in the ancestry computation.
I'm not 100% sure what you're trying to accomplish. If it's to effectively remove the branch, then as long as you haven't pushed, you can likely use the MQ extension. Import the changesets, pop all. Ensure you're updated to the stable branch (which it should be by default), and push them all back on.
They should now all be on the stable branch.